summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httpservers.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-02 18:56:54 (GMT)
committerGeorg Brandl <georg@python.org>2010-08-02 18:56:54 (GMT)
commit6fcac0d6f6d513b2cd9bc8df4e42fbf6d46521bd (patch)
treecd963be3068ce6627bb955c3d120ed481106bf8d /Lib/test/test_httpservers.py
parent65e5f80c484a788c5084ba8fca92af91b0bb7696 (diff)
downloadcpython-6fcac0d6f6d513b2cd9bc8df4e42fbf6d46521bd.zip
cpython-6fcac0d6f6d513b2cd9bc8df4e42fbf6d46521bd.tar.gz
cpython-6fcac0d6f6d513b2cd9bc8df4e42fbf6d46521bd.tar.bz2
Move test_SimpleHTTPServer into test_httpservers.
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r--Lib/test/test_httpservers.py38
1 files changed, 33 insertions, 5 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 4895b65..b276c73 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -401,13 +401,41 @@ class CGIHTTPServerTestCase(BaseTestCase):
(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):
+ cwd = os.getcwd()
try:
- cwd = os.getcwd()
- support.run_unittest(BaseHTTPServerTestCase,
- SimpleHTTPServerTestCase,
- CGIHTTPServerTestCase
- )
+ support.run_unittest(
+ BaseHTTPServerTestCase,
+ SimpleHTTPServerTestCase,
+ CGIHTTPServerTestCase,
+ SimpleHTTPRequestHandlerTestCase,
+ )
finally:
os.chdir(cwd)