From e8ec37109beefda480219228f8ebf307f6083f92 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Sun, 1 May 2011 19:08:12 +1000 Subject: [PATCH] Still more range test fiddling. --- devel/test.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/devel/test.py b/devel/test.py index f88c1f1..d75b343 100755 --- a/devel/test.py +++ b/devel/test.py @@ -204,25 +204,35 @@ class TestFileGet(TestHelper): self.assertEquals(hdrs["Content-Length"], str(len_out)) self.assertEquals(body, data_out) + def test_range_single(self): + self.drive_range("5-5", "5-5/%d" % self.datalen, + 1, self.data[5]) + def test_range_reasonable(self): self.drive_range("10-20", "10-20/%d" % self.datalen, 20-10+1, self.data[10:20+1]) - def test_range_tail(self): + def test_range_start_given(self): self.drive_range("10-", "10-%d/%d" % (self.datalen-1, self.datalen), self.datalen-10, self.data[10:]) - def test_range_negative(self): - self.drive_range("-25", "%d-%d/%d" % ( - self.datalen-25, self.datalen-1, self.datalen), + def test_range_end_given(self): + self.drive_range("-25", + "%d-%d/%d"%(self.datalen-25, self.datalen-1, self.datalen), 25, self.data[-25:]) - def test_range_bad_end(self): - # expecting same result as test_range_negative + def test_range_beyond_end(self): + # expecting same result as test_range_end_given self.drive_range("%d-%d"%(self.datalen-25, self.datalen*2), "%d-%d/%d"%(self.datalen-25, self.datalen-1, self.datalen), 25, self.data[-25:]) + def test_range_end_given_oversize(self): + # expecting full file + self.drive_range("-%d"%(self.datalen*3), + "0-%d/%d"%(self.datalen-1, self.datalen), + self.datalen, self.data) + def test_range_bad_start(self): resp = Conn().get(self.url, req_hdrs = {"Range": "bytes=%d-"%( self.datalen*2)})