mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Re-arrange tests, no functional change.
This commit is contained in:
parent
b6df049c49
commit
0b5d1d881c
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user