Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_conftest.py
# Copyright (C) 2021 The Software Heritage developers | # Copyright (C) 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 | ||||
from swh.provenance.interface import ProvenanceInterface | from swh.provenance.interface import ProvenanceInterface | ||||
from swh.provenance.tests.conftest import fill_storage, load_repo_data | from swh.provenance.tests.conftest import fill_storage, load_repo_data | ||||
from swh.storage.interface import StorageInterface | from swh.storage.interface import StorageInterface | ||||
def test_provenance_fixture(provenance: ProvenanceInterface) -> None: | def test_provenance_fixture(provenance: ProvenanceInterface) -> None: | ||||
"""Check the 'provenance' fixture produce a working ProvenanceDB object""" | """Check the 'provenance' fixture produce a working | ||||
ProvenanceStoragePostgreSql object""" | |||||
assert provenance | assert provenance | ||||
provenance.flush() # should be a noop | provenance.flush() # should be a noop | ||||
def test_fill_storage(swh_storage: StorageInterface) -> None: | def test_fill_storage(swh_storage: StorageInterface) -> None: | ||||
"""Check the 'fill_storage' test utility produces a working Storage | """Check the 'fill_storage' test utility produces a working Storage | ||||
object with at least some Content, Revision and Directory in it""" | object with at least some Content, Revision and Directory in it""" | ||||
data = load_repo_data("cmdbts2") | data = load_repo_data("cmdbts2") | ||||
fill_storage(swh_storage, data) | fill_storage(swh_storage, data) | ||||
assert swh_storage | assert swh_storage | ||||
assert swh_storage.content_get_random() | assert swh_storage.content_get_random() | ||||
assert swh_storage.directory_get_random() | assert swh_storage.directory_get_random() | ||||
assert swh_storage.revision_get_random() | assert swh_storage.revision_get_random() |