swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7fa0e20b84e0>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fa0e157a048>
not_gzipped_tarball_bytes = b'8sync-0.1.0/\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
def test_archive_not_gzipped_tarball(
swh_storage, requests_mock, not_gzipped_tarball_bytes
):
"""Check that a tarball erroneously marked as gzip compressed can still
be downloaded and processed.
"""
filename = "not_gzipped_tarball.tar.gz"
url = f"https://example.org/ftp/{filename}"
requests_mock.get(
url,
[
{"exc": ContentDecodingError,},
{"body": BytesIO(not_gzipped_tarball_bytes),},
],
)
loader = ArchiveLoader(
swh_storage,
url,
artifacts=[
{
"time": 944729610,
"url": url,
"length": 221837,
"filename": filename,
"version": "0.1.0",
}
],
)
actual_load_status = loader.load()
> assert actual_load_status["status"] == "eventful"
E AssertionError: assert 'uneventful' == 'eventful'
E - eventful
E + uneventful
E ? ++
.tox/py3/lib/python3.7/site-packages/swh/loader/package/archive/tests/test_archive.py:484: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 9 2021, 4:34 PM