Fixed issue with unicode login:password

Added EIS info
Added testing cases.
This commit is contained in:
2013-11-08 18:14:40 +01:00
parent e20dd076c3
commit e6f1a06545
3 changed files with 167 additions and 46 deletions

View File

@@ -0,0 +1,57 @@
note
description: "[
Eiffel tests that can be executed by testing tool.
]"
author: "EiffelStudio test wizard"
date: "$Date$"
revision: "$Revision$"
testing: "type/manual"
class
HTTP_AUTHORIZATION_TESTS
inherit
EQA_TEST_SET
feature -- Test routines
test_basic
-- New test routine
local
l_auth: READABLE_STRING_8
u,p: detachable READABLE_STRING_32
h: HTTP_AUTHORIZATION
do
l_auth := "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
create h.make (l_auth)
assert ("login", attached h.login as l_login and then l_login.same_string ("Aladdin"))
assert ("password", attached h.password as l_password and then l_password.same_string ("open sesame"))
check_basic_auth_for_login_password ("Aladdin", "open sesame", "Aladdin")
check_basic_auth_for_login_password ("", "", "empty")
check_basic_auth_for_login_password ("@#$@%%@??<.,.,", "@@#$&)&*>M<?>:ASDFDSA''", "symbol")
check_basic_auth_for_login_password ({STRING_32} "%/20320/%/22909/%/21527/", {STRING_32}"%/20320/%/22909/%/21527/", "unicode")
check_basic_auth_for_login_password (create {STRING_32}.make_filled ('u', 100) + {STRING_32}"%/20320/%/22909/%/21527/", create {STRING_32}.make_filled ('p', 100) + {STRING_32}"%/20320/%/22909/%/21527/", "long unicode")
end
feature -- Impl
check_basic_auth_for_login_password (u,p: READABLE_STRING_32; a_title: READABLE_STRING_8)
local
h: HTTP_AUTHORIZATION
l_auth: READABLE_STRING_8
do
create h.make_basic_auth (u, p)
assert (a_title + ":login", attached h.login as l_login and then l_login.same_string (u))
assert (a_title + ":password", attached h.password as l_password and then l_password.same_string (p))
l_auth := h.http_authorization
create h.make (l_auth)
assert (a_title + ":basic", h.type.is_case_insensitive_equal ("Basic"))
assert (a_title + ":login", attached h.login as l_login and then l_login.same_string (u))
assert (a_title + ":password", attached h.password as l_password and then l_password.same_string (p))
end
end

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="testing" uuid="1AEF36BD-FB72-4B52-8845-4EF4AC7B709A">
<target name="testing">
<root class="ANY" feature="default_create"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="transitional" syntax="standard">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http_authorization" location="..\http_authorization-safe.ecf" readonly="false" use_application_options="true"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
<tests name="tests" location=".\" recursive="true"/>
</target>
</system>