mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Use setUp and tearDown to manage test file.
This commit is contained in:
parent
0b5d1d881c
commit
449b78efaa
@ -72,13 +72,15 @@ class TestHelper(unittest.TestCase):
|
||||
'Generated by darkhttpd')
|
||||
|
||||
class TestDirList(TestHelper):
|
||||
def setUp(self):
|
||||
self.fn = WWWROOT+"/escape#this"
|
||||
open(self.fn, "w").write("x"*12345)
|
||||
|
||||
def tearDown(self):
|
||||
os.unlink(self.fn)
|
||||
|
||||
def test_dirlist_escape(self):
|
||||
fn = WWWROOT+"/escape#this"
|
||||
open(fn, "w").write("x"*12345)
|
||||
try:
|
||||
resp = Conn().get("/")
|
||||
finally:
|
||||
os.unlink(fn)
|
||||
resp = Conn().get("/")
|
||||
status, hdrs, body = parse(resp)
|
||||
self.assertEquals(ord("#"), 0x23)
|
||||
self.assertContains(body, "escape%23this", "12345")
|
||||
|
Loading…
Reference in New Issue
Block a user