Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_loader.py
# Copyright (C) 2016-2020 The Software Heritage developers | # Copyright (C) 2016-2021 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 os | import os | ||||
from swh.loader.svn.loader import SvnLoader, SvnLoaderFromRemoteDump | from swh.loader.svn.loader import SvnLoader, SvnLoaderFromRemoteDump | ||||
from swh.loader.tests import ( | from swh.loader.tests import ( | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | def test_loader_tampered_repository(swh_config, datadir, tmp_path): | ||||
repo_tampered_url = prepare_repository_from_archive( | repo_tampered_url = prepare_repository_from_archive( | ||||
archive_path2, archive_name, tmp_path | archive_path2, archive_name, tmp_path | ||||
) | ) | ||||
loader2 = SvnLoader(repo_tampered_url, origin_url=repo_url) | loader2 = SvnLoader(repo_tampered_url, origin_url=repo_url) | ||||
assert loader2.load() == {"status": "failed"} | assert loader2.load() == {"status": "failed"} | ||||
assert_last_visit_matches( | assert_last_visit_matches( | ||||
loader2.storage, repo_url, status="partial", type="svn", snapshot=None, | loader2.storage, repo_url, status="failed", type="svn", snapshot=None, | ||||
) | ) | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert stats["origin"] == 1 | assert stats["origin"] == 1 | ||||
assert stats["origin_visit"] == 2 | assert stats["origin_visit"] == 2 | ||||
assert stats["snapshot"] == 1 | assert stats["snapshot"] == 1 | ||||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |