Test directory redirect.

This commit is contained in:
Emil Mikulic 2011-05-01 19:13:25 +10:00
parent 862e3ac124
commit 22b4dac09b

View File

@ -151,6 +151,21 @@ def setUpModule():
]:
makeSimpleCases(*args)
class TestDirRedirect(TestHelper):
def setUp(self):
self.url = "/mydir"
self.fn = WWWROOT + self.url
os.mkdir(self.fn)
def tearDown(self):
os.rmdir(self.fn)
def test_dir_redirect(self):
resp = Conn().get(self.url)
status, hdrs, body = parse(resp)
self.assertContains(status, "301 Moved Permanently")
self.assertEquals(hdrs["Location"], self.url+"/") # trailing slash
class TestFileGet(TestHelper):
def setUp(self):
self.datalen = 2345