def test_md5_multiple_matches(self):
        another_checksum = u"eW91IGRpZCBXQVQgbm93Pw=="
        header_value = u"md5={},md5={}".format(self.MD5_CHECKSUM, another_checksum)
        response = mock.sentinel.response

        with pytest.raises(common.InvalidResponse) as exc_info:
            download_mod._parse_md5_header(header_value, response)

        error = exc_info.value
        assert error.response is response
        assert len(error.args) == 3
        assert error.args[1] == header_value
        assert error.args[2] == [self.MD5_CHECKSUM, another_checksum]
 def test_both_crc32c_and_md5(self):
     header_value = u"crc32c={},md5={}".format(
         self.CRC32C_CHECKSUM, self.MD5_CHECKSUM
     )
     response = None
     md5_header = download_mod._parse_md5_header(header_value, response)
     assert md5_header == self.MD5_CHECKSUM
예제 #3
0
 def test_md5_only(self):
     header_value = u'md5={}'.format(self.MD5_CHECKSUM)
     response = None
     md5_header = download_mod._parse_md5_header(header_value, response)
     assert md5_header == self.MD5_CHECKSUM
예제 #4
0
 def test_crc32c_only(self):
     header_value = u'crc32c={}'.format(self.CRC32C_CHECKSUM)
     response = None
     md5_header = download_mod._parse_md5_header(header_value, response)
     assert md5_header is None
예제 #5
0
 def test_empty_value(self):
     header_value = None
     response = None
     md5_header = download_mod._parse_md5_header(header_value, response)
     assert md5_header is None