diff options
author | Georg Brandl <georg@python.org> | 2010-08-02 18:56:54 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-08-02 18:56:54 (GMT) |
commit | 6fcac0d6f6d513b2cd9bc8df4e42fbf6d46521bd (patch) | |
tree | cd963be3068ce6627bb955c3d120ed481106bf8d /Lib/test/test_httpservers.py | |
parent | 65e5f80c484a788c5084ba8fca92af91b0bb7696 (diff) | |
download | cpython-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.py | 38 |
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) |