Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/archive/tests/test_archive.py
# Copyright (C) 2019-2021 The Software Heritage developers | # Copyright (C) 2019-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import copy | |||||
import datetime | import datetime | ||||
import hashlib | import hashlib | ||||
from io import BytesIO | from io import BytesIO | ||||
from pathlib import Path | from pathlib import Path | ||||
import string | import string | ||||
import attr | import attr | ||||
import pytest | import pytest | ||||
▲ Show 20 Lines • Show All 467 Lines • ▼ Show 20 Lines | ): | ||||
actual_load_status = loader.load() | actual_load_status = loader.load() | ||||
assert actual_load_status["status"] == "eventful" | assert actual_load_status["status"] == "eventful" | ||||
assert actual_load_status["snapshot_id"] is not None | assert actual_load_status["snapshot_id"] is not None | ||||
snapshot = loader.last_snapshot() | snapshot = loader.last_snapshot() | ||||
assert len(snapshot.branches) == 2 | assert len(snapshot.branches) == 2 | ||||
assert b"releases/0.1.0" in snapshot.branches | assert b"releases/0.1.0" in snapshot.branches | ||||
def test_archive_visit_no_time_for_tarball(swh_storage, requests_mock_datadir): | |||||
artifacts = copy.deepcopy(GNU_ARTIFACTS) | |||||
for artifact in artifacts: | |||||
artifact["time"] = None | |||||
loader = ArchiveLoader(swh_storage, URL, artifacts=artifacts) | |||||
actual_load_status = loader.load() | |||||
assert actual_load_status["status"] == "eventful" | |||||
assert_last_visit_matches(swh_storage, URL, status="full", type="tar") |