Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/tests/test_init.py
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020-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 datetime | import datetime | ||||
import os | import os | ||||
import subprocess | import subprocess | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | branches={ | ||||
target=hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | target=hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | ||||
target_type=TargetType.REVISION, | target_type=TargetType.REVISION, | ||||
), | ), | ||||
}, | }, | ||||
) | ) | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_storage_backend_config(swh_storage_postgresql): | |||||
return { | |||||
"cls": "local", | |||||
"db": swh_storage_postgresql.dsn, | |||||
"objstorage": {"cls": "memory"}, | |||||
} | |||||
@pytest.fixture | |||||
def mock_storage(mocker): | def mock_storage(mocker): | ||||
mock_storage = mocker.patch("swh.loader.tests.origin_get_latest_visit_status") | mock_storage = mocker.patch("swh.loader.tests.origin_get_latest_visit_status") | ||||
mock_storage.return_value = ORIGIN_VISIT_STATUS | mock_storage.return_value = ORIGIN_VISIT_STATUS | ||||
return mock_storage | return mock_storage | ||||
def test_assert_last_visit_matches_raise(mock_storage, mocker): | def test_assert_last_visit_matches_raise(mock_storage, mocker): | ||||
"""Not finding origin visit_and_statu should raise | """Not finding origin visit_and_statu should raise | ||||
▲ Show 20 Lines • Show All 333 Lines • Show Last 20 Lines |