Add test to exercise memove() in make_safe_url()

This commit is contained in:
Emil Mikulic 2013-06-10 19:26:25 +10:00
parent ecfac80174
commit e6680c4f2f

View File

@ -189,8 +189,8 @@ class TestFileGet(TestHelper):
def tearDown(self): def tearDown(self):
os.unlink(self.fn) os.unlink(self.fn)
def test_file_get(self): def get_helper(self, url):
resp = Conn().get(self.url) resp = Conn().get(url)
status, hdrs, body = parse(resp) status, hdrs, body = parse(resp)
self.assertContains(status, "200 OK") self.assertContains(status, "200 OK")
self.assertEquals(hdrs["Accept-Ranges"], "bytes") self.assertEquals(hdrs["Accept-Ranges"], "bytes")
@ -199,6 +199,12 @@ class TestFileGet(TestHelper):
self.assertContains(hdrs["Server"], "darkhttpd/") self.assertContains(hdrs["Server"], "darkhttpd/")
self.assertEquals(body, self.data) self.assertEquals(body, self.data)
def test_file_get(self):
self.get_helper(self.url)
def test_file_get_redundant_dots(self):
self.get_helper("/././." + self.url)
def test_file_head(self): def test_file_head(self):
resp = Conn().get(self.url, method="HEAD") resp = Conn().get(self.url, method="HEAD")
status, hdrs, body = parse(resp) status, hdrs, body = parse(resp)