From 22b4dac09b7dcf74388efc6e00c59fd12665d1b4 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Sun, 1 May 2011 19:13:25 +1000 Subject: [PATCH] Test directory redirect. --- devel/test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devel/test.py b/devel/test.py index d75b343..541822a 100755 --- a/devel/test.py +++ b/devel/test.py @@ -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