mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Allow running of individual tests from cmdline.
This commit is contained in:
parent
d65990449e
commit
b8bf9a0f72
@ -102,6 +102,7 @@ def makeCase(name, url, hdr_checker=None, body_checker=None,
|
|||||||
nerf("HTTP"+v),
|
nerf("HTTP"+v),
|
||||||
{"\n":"LF", "\r\n":"CRLF"}[endl],
|
{"\n":"LF", "\r\n":"CRLF"}[endl],
|
||||||
])
|
])
|
||||||
|
do_test.__name__ = test_name # hax
|
||||||
setattr(TestCases, test_name, do_test)
|
setattr(TestCases, test_name, do_test)
|
||||||
|
|
||||||
def makeCases(name, url, hdr_checker=None, body_checker=None,
|
def makeCases(name, url, hdr_checker=None, body_checker=None,
|
||||||
@ -117,6 +118,7 @@ def makeSimpleCases(name, url, assert_name):
|
|||||||
makeCases(name, url, None,
|
makeCases(name, url, None,
|
||||||
lambda self,body: getattr(self, assert_name)(body, url))
|
lambda self,body: getattr(self, assert_name)(body, url))
|
||||||
|
|
||||||
|
def setUpModule():
|
||||||
for args in [
|
for args in [
|
||||||
["index", "/", "assertIsIndex"],
|
["index", "/", "assertIsIndex"],
|
||||||
["up dir", "/dir/../", "assertIsIndex"],
|
["up dir", "/dir/../", "assertIsIndex"],
|
||||||
@ -128,8 +130,8 @@ for args in [
|
|||||||
]:
|
]:
|
||||||
makeSimpleCases(*args)
|
makeSimpleCases(*args)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
setUpModule()
|
||||||
unittest.main()
|
unittest.main()
|
||||||
#x = Conn().get("/xyz/../", "1.0")
|
#x = Conn().get("/xyz/../", "1.0")
|
||||||
#y = parse(x)
|
#y = parse(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user