Added test cases for PATH_INFO and percent_encoded_path_info for root url cases.
Removed obsolete calls from TEST_EXECUTION_I .
This commit is contained in:
@@ -127,7 +127,7 @@ feature -- Execution
|
|||||||
|
|
||||||
new_file (req: WSF_REQUEST; a_suffix: STRING): detachable FILE
|
new_file (req: WSF_REQUEST; a_suffix: STRING): detachable FILE
|
||||||
local
|
local
|
||||||
dp, p, fp: FILE_NAME
|
dp, p, fp: PATH
|
||||||
d: DIRECTORY
|
d: DIRECTORY
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
f: detachable FILE
|
f: detachable FILE
|
||||||
@@ -135,7 +135,7 @@ feature -- Execution
|
|||||||
do
|
do
|
||||||
if retried = 0 then
|
if retried = 0 then
|
||||||
create dp.make_from_string ("logs")
|
create dp.make_from_string ("logs")
|
||||||
create d.make (dp.string)
|
create d.make_with_path (dp)
|
||||||
if not d.exists then
|
if not d.exists then
|
||||||
d.recursive_create_dir
|
d.recursive_create_dir
|
||||||
end
|
end
|
||||||
@@ -147,29 +147,25 @@ feature -- Execution
|
|||||||
|
|
||||||
from
|
from
|
||||||
i := 0
|
i := 0
|
||||||
create fp.make_from_string (dp.string)
|
|
||||||
if p.is_empty then
|
if p.is_empty then
|
||||||
fp.set_file_name (p.string + a_suffix)
|
fp := dp.extended (a_suffix)
|
||||||
else
|
else
|
||||||
fp.set_file_name (p.string + "-" + a_suffix)
|
fp := dp.extended_path (p).appended ("-" + a_suffix)
|
||||||
end
|
end
|
||||||
create {PLAIN_TEXT_FILE} f.make (fp.string)
|
create {PLAIN_TEXT_FILE} f.make_with_path (fp)
|
||||||
until
|
until
|
||||||
not f.exists
|
not f.exists
|
||||||
loop
|
loop
|
||||||
i := i + 1
|
i := i + 1
|
||||||
create fp.make_from_string (dp.string)
|
|
||||||
if p.is_empty then
|
if p.is_empty then
|
||||||
fp.set_file_name (p.string + i.out + "-" + a_suffix)
|
fp := dp.extended (i.out + "-" + a_suffix)
|
||||||
else
|
else
|
||||||
fp.set_file_name (p.string + "_" + i.out + "-" + a_suffix)
|
fp := dp.extended_path (p).appended ("_" + i.out + "-" + a_suffix)
|
||||||
end
|
end
|
||||||
|
f.make_with_path (fp)
|
||||||
f.make (fp.string)
|
|
||||||
end
|
end
|
||||||
f.open_write
|
f.open_write
|
||||||
elseif retried < 5 then
|
elseif retried < 5 then
|
||||||
|
|
||||||
-- Eventually another request created the file at the same time ..
|
-- Eventually another request created the file at the same time ..
|
||||||
f := new_file (req, a_suffix)
|
f := new_file (req, a_suffix)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ feature -- Tests
|
|||||||
)
|
)
|
||||||
s := req.script_url ("/new/path/")
|
s := req.script_url ("/new/path/")
|
||||||
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/"))
|
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/"))
|
||||||
|
assert ("valid path info", req.path_info.same_string_general ("/test/home"))
|
||||||
|
assert ("valid path info", req.percent_encoded_path_info.same_string_general ("/test/home"))
|
||||||
end
|
end
|
||||||
|
|
||||||
test_script_url_2
|
test_script_url_2
|
||||||
@@ -84,7 +86,48 @@ feature -- Tests
|
|||||||
)
|
)
|
||||||
s := req.script_url ("/new/path/")
|
s := req.script_url ("/new/path/")
|
||||||
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/intranet/collab/cms/new/path/%"", s.same_string ("/intranet/collab/cms/new/path/"))
|
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/intranet/collab/cms/new/path/%"", s.same_string ("/intranet/collab/cms/new/path/"))
|
||||||
|
assert ("path_info", req.path_info.same_string_general ("/home"))
|
||||||
|
assert ("percent_encoded_path_info", req.percent_encoded_path_info.same_string_general ("/home"))
|
||||||
|
end
|
||||||
|
|
||||||
|
test_script_url_4
|
||||||
|
local
|
||||||
|
req: WSF_REQUEST
|
||||||
|
s: READABLE_STRING_8
|
||||||
|
do
|
||||||
|
--| Case #3
|
||||||
|
req := new_request (<<
|
||||||
|
["REQUEST_METHOD", "GET"],
|
||||||
|
["QUERY_STRING", ""],
|
||||||
|
["REQUEST_URI", "/support/"],
|
||||||
|
["SCRIPT_NAME", "/support/esa_api.exe"],
|
||||||
|
["PATH_INFO", ""]
|
||||||
|
>>
|
||||||
|
)
|
||||||
|
s := req.script_url ("/new/path/")
|
||||||
|
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/support/new/path/%"", s.same_string ("/support/new/path/"))
|
||||||
|
assert ("path_info", req.path_info.same_string_general (""))
|
||||||
|
assert ("percent_encoded_path_info", req.percent_encoded_path_info.same_string_general (""))
|
||||||
|
end
|
||||||
|
|
||||||
|
test_script_url_5
|
||||||
|
local
|
||||||
|
req: WSF_REQUEST
|
||||||
|
s: READABLE_STRING_8
|
||||||
|
do
|
||||||
|
--| Case #3
|
||||||
|
req := new_request (<<
|
||||||
|
["REQUEST_METHOD", "GET"],
|
||||||
|
["QUERY_STRING", ""],
|
||||||
|
["REQUEST_URI", "/support/"],
|
||||||
|
["SCRIPT_NAME", "/support/esa_api.exe"],
|
||||||
|
["PATH_INFO", "/"]
|
||||||
|
>>
|
||||||
|
)
|
||||||
|
s := req.script_url ("/new/path/")
|
||||||
|
assert ("script_url (/new/path/) = %""+s+"%" but should be %"/support/new/path/%"", s.same_string ("/support/new/path/"))
|
||||||
|
assert ("path_info", req.path_info.same_string_general ("/"))
|
||||||
|
assert ("percent_encoded_path_info", req.percent_encoded_path_info.same_string_general ("/"))
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|||||||
Reference in New Issue
Block a user