Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6fcac0d6
Commit
6fcac0d6
authored
Aug 02, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test_SimpleHTTPServer into test_httpservers.
parent
65e5f80c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
46 deletions
+33
-46
Lib/test/test_SimpleHTTPServer.py
Lib/test/test_SimpleHTTPServer.py
+0
-41
Lib/test/test_httpservers.py
Lib/test/test_httpservers.py
+33
-5
No files found.
Lib/test/test_SimpleHTTPServer.py
deleted
100644 → 0
View file @
65e5f80c
"""
These tests only check url parsing for now.
We don't want to require the 'network' resource.
"""
import
os
,
unittest
from
http.server
import
SimpleHTTPRequestHandler
from
test
import
support
class
SocketlessRequestHandler
(
SimpleHTTPRequestHandler
):
def
__init__
(
self
):
pass
class
SimpleHTTPRequestHandlerTestCase
(
unittest
.
TestCase
):
""" Test url parsing """
def
setUp
(
self
):
self
.
translated
=
os
.
getcwd
()
self
.
translated
=
os
.
path
.
join
(
self
.
translated
,
'filename'
)
self
.
handler
=
SocketlessRequestHandler
()
def
test_queryArguments
(
self
):
path
=
self
.
handler
.
translate_path
(
'/filename'
)
self
.
assertEquals
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'/filename?foo=bar'
)
self
.
assertEquals
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'/filename?a=b&spam=eggs#zot'
)
self
.
assertEquals
(
path
,
self
.
translated
)
def
test_startWithDoubleSlash
(
self
):
path
=
self
.
handler
.
translate_path
(
'//filename'
)
self
.
assertEquals
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'//filename?foo=bar'
)
self
.
assertEquals
(
path
,
self
.
translated
)
def
test_main
():
support
.
run_unittest
(
SimpleHTTPRequestHandlerTestCase
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_httpservers.py
View file @
6fcac0d6
...
@@ -401,13 +401,41 @@ class CGIHTTPServerTestCase(BaseTestCase):
...
@@ -401,13 +401,41 @@ class CGIHTTPServerTestCase(BaseTestCase):
(
res
.
read
(),
res
.
getheader
(
'Content-type'
),
res
.
status
))
(
res
.
read
(),
res
.
getheader
(
'Content-type'
),
res
.
status
))
class
SocketlessRequestHandler
(
SimpleHTTPRequestHandler
):
def
__init__
(
self
):
pass
class
SimpleHTTPRequestHandlerTestCase
(
unittest
.
TestCase
):
""" Test url parsing """
def
setUp
(
self
):
self
.
translated
=
os
.
getcwd
()
self
.
translated
=
os
.
path
.
join
(
self
.
translated
,
'filename'
)
self
.
handler
=
SocketlessRequestHandler
()
def
test_query_arguments
(
self
):
path
=
self
.
handler
.
translate_path
(
'/filename'
)
self
.
assertEqual
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'/filename?foo=bar'
)
self
.
assertEqual
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'/filename?a=b&spam=eggs#zot'
)
self
.
assertEqual
(
path
,
self
.
translated
)
def
test_start_with_double_slash
(
self
):
path
=
self
.
handler
.
translate_path
(
'//filename'
)
self
.
assertEqual
(
path
,
self
.
translated
)
path
=
self
.
handler
.
translate_path
(
'//filename?foo=bar'
)
self
.
assertEqual
(
path
,
self
.
translated
)
def
test_main
(
verbose
=
None
):
def
test_main
(
verbose
=
None
):
cwd
=
os
.
getcwd
()
try
:
try
:
cwd
=
os
.
getcwd
()
support
.
run_unittest
(
support
.
run_unittest
(
BaseHTTPServerTestCase
,
BaseHTTPServerTestCase
,
SimpleHTTPServerTestCase
,
SimpleHTTPServerTestCase
,
CGIHTTPServerTestCase
CGIHTTPServerTestCase
,
)
SimpleHTTPRequestHandlerTestCase
,
)
finally
:
finally
:
os
.
chdir
(
cwd
)
os
.
chdir
(
cwd
)
...
...
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