Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/deposit/tests/test_deposit.py
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | def test_deposit_loading_ok(swh_config, requests_mock_datadir): | ||||
revision = next(loader.storage.revision_get([revision_id])) | revision = next(loader.storage.revision_get([revision_id])) | ||||
assert revision | assert revision | ||||
# check metadata | # check metadata | ||||
fetcher = MetadataFetcher(name="swh-deposit", version="0.0.1",) | fetcher = MetadataFetcher(name="swh-deposit", version="0.0.1",) | ||||
authority = MetadataAuthority( | authority = MetadataAuthority( | ||||
type=MetadataAuthorityType.DEPOSIT, | type=MetadataAuthorityType.DEPOSIT_CLIENT, | ||||
url="https://hal-test.archives-ouvertes.fr/", | url="https://hal-test.archives-ouvertes.fr/", | ||||
) | ) | ||||
orig_meta = loader.storage.object_metadata_get( | orig_meta = loader.storage.object_metadata_get( | ||||
MetadataTargetType.ORIGIN, url, authority | MetadataTargetType.ORIGIN, url, authority | ||||
) | ) | ||||
assert orig_meta is not None | assert orig_meta is not None | ||||
assert isinstance(orig_meta, dict) | assert isinstance(orig_meta, dict) | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | assert revision["metadata"] == { | ||||
"length": 956830, | "length": 956830, | ||||
} | } | ||||
], | ], | ||||
} | } | ||||
fetcher = MetadataFetcher(name="swh-deposit", version="0.0.1",) | fetcher = MetadataFetcher(name="swh-deposit", version="0.0.1",) | ||||
authority = MetadataAuthority( | authority = MetadataAuthority( | ||||
type=MetadataAuthorityType.DEPOSIT, | type=MetadataAuthorityType.DEPOSIT_CLIENT, | ||||
url="https://hal-test.archives-ouvertes.fr/", | url="https://hal-test.archives-ouvertes.fr/", | ||||
) | ) | ||||
# Check the metadata swh side | # Check the metadata swh side | ||||
orig_meta = loader.storage.object_metadata_get( | orig_meta = loader.storage.object_metadata_get( | ||||
MetadataTargetType.ORIGIN, url, authority | MetadataTargetType.ORIGIN, url, authority | ||||
) | ) | ||||
assert orig_meta is not None | assert orig_meta is not None | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |