Re-arrange tests, no functional change.
authorEmil Mikulic <emikulic@gmail.com>
Sun, 17 Apr 2011 09:00:04 +0000 (19:00 +1000)
committerEmil Mikulic <emikulic@gmail.com>
Sun, 28 Apr 2013 10:56:14 +0000 (20:56 +1000)
devel/test.py

index 358b609..ad6163c 100755 (executable)
@@ -51,7 +51,7 @@ def parse(resp):
         hdrs[k] = v
     return (status, hdrs, body)
 
-class TestCases(unittest.TestCase):
+class TestHelper(unittest.TestCase):
     def assertContains(self, body, *strings):
         for s in strings:
             self.assertTrue(s in body,
@@ -71,6 +71,7 @@ class TestCases(unittest.TestCase):
             "You requested an invalid URL: %s\n"%path,
             'Generated by darkhttpd')
 
+class TestDirList(TestHelper):
     def test_dirlist_escape(self):
         fn = WWWROOT+"/escape#this"
         open(fn, "w").write("x"*12345)
@@ -82,6 +83,9 @@ class TestCases(unittest.TestCase):
         self.assertEquals(ord("#"), 0x23)
         self.assertContains(body, "escape%23this", "12345")
 
+class TestCases(TestHelper):
+    pass # these get autogenerated in setUpModule()
+
 def nerf(s):
     return re.sub("[^a-zA-Z0-9]", "_", s)
 
@@ -123,9 +127,7 @@ def makeCase(name, url, hdr_checker=None, body_checker=None,
 
 def makeCases(name, url, hdr_checker=None, body_checker=None,
               req_hdrs={"User-Agent": "test.py"}):
-    # FIXME: 0.9 is broken
     for http_ver in [None, "1.0", "1.1"]:
-    #for http_ver in ["1.0", "1.1"]:
         for endl in ["\n", "\r\n"]:
             makeCase(name, url, hdr_checker, body_checker,
                      req_hdrs, http_ver, endl)
@@ -149,8 +151,5 @@ def setUpModule():
 if __name__ == '__main__':
     setUpModule()
     unittest.main()
-    #x = Conn().get("/xyz/../", "1.0")
-    #y = parse(x)
-    #print repr(y)
 
 # vim:set ts=4 sw=4 et: