def test_parse_range_header(self):
   """Test ParseRangeHeader function."""
   self.assertEquals(
       (None, None), blob_download._parse_range_header(''))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('invalid'))
   self.assertEquals(
       (1, None), blob_download._parse_range_header('bytes=1-'))
   self.assertEquals(
       (10, 21), blob_download._parse_range_header('bytes=10-20'))
   self.assertEquals(
       (-30, None), blob_download._parse_range_header('bytes=-30'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=-30-'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=-30-40'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=0-1,2-3'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=-0'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bits=0-20'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=a-20'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=0-a'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=0--'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=--10'))
   self.assertEquals(
       (None, None), blob_download._parse_range_header('bytes=0--10'))
Exemple #2
0
 def test_parse_range_header(self):
     """Test ParseRangeHeader function."""
     self.assertEquals((None, None), blob_download._parse_range_header(''))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('invalid'))
     self.assertEquals((1, None),
                       blob_download._parse_range_header('bytes=1-'))
     self.assertEquals((10, 21),
                       blob_download._parse_range_header('bytes=10-20'))
     self.assertEquals((-30, None),
                       blob_download._parse_range_header('bytes=-30'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=-30-'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=-30-40'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=0-1,2-3'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=-0'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bits=0-20'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=a-20'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=0-a'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=0--'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=--10'))
     self.assertEquals((None, None),
                       blob_download._parse_range_header('bytes=0--10'))
 def test_parse_range_header(self):
     """Test ParseRangeHeader function."""
     self.assertEquals((None, None), blob_download._parse_range_header(""))
     self.assertEquals((None, None), blob_download._parse_range_header("invalid"))
     self.assertEquals((1, None), blob_download._parse_range_header("bytes=1-"))
     self.assertEquals((10, 21), blob_download._parse_range_header("bytes=10-20"))
     self.assertEquals((-30, None), blob_download._parse_range_header("bytes=-30"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=-30-"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=-30-40"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=0-1,2-3"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=-0"))
     self.assertEquals((None, None), blob_download._parse_range_header("bits=0-20"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=a-20"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=0-a"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=0--"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=--10"))
     self.assertEquals((None, None), blob_download._parse_range_header("bytes=0--10"))