libcurl: Applied a workaround to avoid issue on Win32 (see LIBCURL_HTTP_CLIENT_REQUEST.apply_workaround)
Separated the http_client-safe.ecf and test-safe.ecf Added HTTP_CLIENT_SESSION.set_max_redirects Fixed broken test due to formatting trouble.
This commit is contained in:
18
library/client/http_client/tests/test-safe.ecf
Normal file
18
library/client/http_client/tests/test-safe.ecf
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="test_http_client" uuid="920E5C50-41E1-4DAC-8D48-D9C860E49228">
|
||||
<target name="test_http_client">
|
||||
<root class="TEST" feature="make"/>
|
||||
<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="all">
|
||||
<assertions precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="http_client" location="..\http_client-safe.ecf" readonly="false"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<tests name="tests" location=".\"/>
|
||||
</target>
|
||||
</system>
|
||||
50
library/client/http_client/tests/test.e
Normal file
50
library/client/http_client/tests/test.e
Normal file
@@ -0,0 +1,50 @@
|
||||
class TEST
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Init
|
||||
|
||||
make
|
||||
do
|
||||
test_http_client
|
||||
end
|
||||
|
||||
test_http_client
|
||||
-- New test routine
|
||||
local
|
||||
sess: LIBCURL_HTTP_CLIENT_SESSION
|
||||
h: STRING_8
|
||||
do
|
||||
create sess.make ("http://www.google.com")
|
||||
if attached sess.get ("/search?q=eiffel", Void) as res then
|
||||
assert ("Get returned without error", not res.error_occurred)
|
||||
create h.make_empty
|
||||
if attached res.headers as hds then
|
||||
across
|
||||
hds as c
|
||||
loop
|
||||
h.append (c.item.name + ": " + c.item.value + "%R%N")
|
||||
end
|
||||
end
|
||||
if attached res.body as l_body then
|
||||
assert ("body not empty", not l_body.is_empty)
|
||||
end
|
||||
assert ("same headers", h.same_string (res.raw_header))
|
||||
else
|
||||
assert ("Not found", False)
|
||||
end
|
||||
end
|
||||
|
||||
assert (m: READABLE_STRING_8; b: BOOLEAN)
|
||||
local
|
||||
e: DEVELOPER_EXCEPTION
|
||||
do
|
||||
if not b then
|
||||
create e
|
||||
e.set_message (m)
|
||||
e.raise
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -23,6 +23,7 @@ feature -- Test routines
|
||||
do
|
||||
create sess.make ("http://www.google.com")
|
||||
if attached sess.get ("/search?q=eiffel", Void) as res then
|
||||
assert ("Get returned without error", not res.error_occurred)
|
||||
create h.make_empty
|
||||
if attached res.headers as hds then
|
||||
across
|
||||
@@ -32,7 +33,9 @@ feature -- Test routines
|
||||
end
|
||||
end
|
||||
if attached res.body as l_body then
|
||||
|
||||
assert ("body not empty", not l_body.is_empty)
|
||||
else
|
||||
assert ("missing body", False)
|
||||
end
|
||||
assert ("same headers", h.same_string (res.raw_header))
|
||||
else
|
||||
@@ -67,20 +70,21 @@ feature -- Test routines
|
||||
h.append (c.item.name + ": " + c.item.value + "%N")
|
||||
end
|
||||
end
|
||||
assert ("Expected headers map", h.same_string ("[
|
||||
normal: NORMAL
|
||||
concat: ABC
|
||||
concat: DEF
|
||||
key1: KEY
|
||||
key2: KEY
|
||||
key3: KEY
|
||||
value1: VALUE
|
||||
value2: VALUE
|
||||
value3: VALUE
|
||||
value4: VALUE
|
||||
foo: BAR
|
||||
|
||||
]"))
|
||||
assert ("Expected headers map", h.same_string (
|
||||
"[
|
||||
normal: NORMAL
|
||||
concat: ABC
|
||||
concat: DEF
|
||||
key1: KEY
|
||||
key2: KEY
|
||||
key3: KEY
|
||||
value1: VALUE
|
||||
value2: VALUE
|
||||
value3: VALUE
|
||||
value4: VALUE
|
||||
foo: BAR
|
||||
|
||||
]"))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user