Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
7f2c2c1b
Commit
7f2c2c1b
authored
Apr 17, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get test_httpservers fixes from
7960b8c3
parent
72119c8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
greentest/2.7/test_httpservers.py
greentest/2.7/test_httpservers.py
+46
-0
No files found.
greentest/2.7/test_httpservers.py
View file @
7f2c2c1b
...
...
@@ -418,6 +418,8 @@ class CGIHTTPServerTestCase(BaseTestCase):
finally
:
BaseTestCase
.
tearDown
(
self
)
@
unittest
.
skipIf
(
hasattr
(
CGIHTTPServer
,
'_url_collapse_path'
),
"Only on <= 2.7.3"
)
def
test_url_collapse_path_split
(
self
):
test_vectors
=
{
''
:
(
'/'
,
''
),
...
...
@@ -457,6 +459,50 @@ class CGIHTTPServerTestCase(BaseTestCase):
msg
=
'path = %r
\
n
Got: %r
\
n
Wanted: %r'
%
(
path
,
actual
,
expected
))
@
unittest
.
skipIf
(
hasattr
(
CGIHTTPServer
,
'_url_collapse_path_split'
),
"Only on >= 2.7.3"
)
def
test_url_collapse_path
(
self
):
# verify tail is the last portion and head is the rest on proper urls
test_vectors
=
{
''
:
'//'
,
'..'
:
IndexError
,
'/.//..'
:
IndexError
,
'/'
:
'//'
,
'//'
:
'//'
,
'/
\
\
'
:
'//
\
\
'
,
'/.//'
:
'//'
,
'cgi-bin/file1.py'
:
'/cgi-bin/file1.py'
,
'/cgi-bin/file1.py'
:
'/cgi-bin/file1.py'
,
'a'
:
'//a'
,
'/a'
:
'//a'
,
'//a'
:
'//a'
,
'./a'
:
'//a'
,
'./C:/'
:
'/C:/'
,
'/a/b'
:
'/a/b'
,
'/a/b/'
:
'/a/b/'
,
'/a/b/.'
:
'/a/b/'
,
'/a/b/c/..'
:
'/a/b/'
,
'/a/b/c/../d'
:
'/a/b/d'
,
'/a/b/c/../d/e/../f'
:
'/a/b/d/f'
,
'/a/b/c/../d/e/../../f'
:
'/a/b/f'
,
'/a/b/c/../d/e/.././././..//f'
:
'/a/b/f'
,
'../a/b/c/../d/e/.././././..//f'
:
IndexError
,
'/a/b/c/../d/e/../../../f'
:
'/a/f'
,
'/a/b/c/../d/e/../../../../f'
:
'//f'
,
'/a/b/c/../d/e/../../../../../f'
:
IndexError
,
'/a/b/c/../d/e/../../../../f/..'
:
'//'
,
'/a/b/c/../d/e/../../../../f/../.'
:
'//'
,
}
for
path
,
expected
in
test_vectors
.
iteritems
():
if
isinstance
(
expected
,
type
)
and
issubclass
(
expected
,
Exception
):
self
.
assertRaises
(
expected
,
CGIHTTPServer
.
_url_collapse_path
,
path
)
else
:
actual
=
CGIHTTPServer
.
_url_collapse_path
(
path
)
self
.
assertEqual
(
expected
,
actual
,
msg
=
'path = %r
\
n
Got: %r
\
n
Wanted: %r'
%
(
path
,
actual
,
expected
))
def
test_headers_and_content
(
self
):
res
=
self
.
request
(
'/cgi-bin/file1.py'
)
self
.
assertEqual
((
'Hello World
\
n
'
,
'text/html'
,
200
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment