swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7ff2b01a60f0>
requests_mock = <requests_mock.mocker.Mocker object at 0x7ff2b021f160>
data_jar_1 = b'PK\x03\x04\n\x00\x00\x08\x08\x00\xba\\\xb7L\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00META-INF/\x...*\x00\x00al/aldi/sprova4j/models/Execution.javaPK\x05\x06\x00\x00\x00\x00#\x00#\x00\xe2\n\x00\x00\xf4,\x00\x00\x00\x00'
def test_metadatata_no_pom(swh_storage, requests_mock, data_jar_1):
"""With no prior visit, loading a jar ends up with 1 snapshot.
Extrinsic metadata is None if the pom file cannot be retrieved.
"""
requests_mock.get(MVN_ARTIFACTS[0]["url"], content=data_jar_1)
requests_mock.get(MVN_ARTIFACTS_POM[0], status_code="404")
loader = MavenLoader(
swh_storage, MVN_ARTIFACTS[0]["url"], artifacts=[MVN_ARTIFACTS[0]]
)
actual_load_status = loader.load()
assert actual_load_status["status"] == "eventful"
expected_release_id = hash_to_bytes(_expected_new_release_first_visit)
release = swh_storage.release_get([expected_release_id])[0]
assert release is not None
release_swhid = CoreSWHID(
object_type=ObjectType.RELEASE, object_id=expected_release_id
)
directory_swhid = ExtendedSWHID(
object_type=ExtendedObjectType.DIRECTORY, object_id=release.target
)
metadata_authority = MetadataAuthority(
type=MetadataAuthorityType.FORGE, url="https://repo1.maven.org/",
)
expected_metadata = [
RawExtrinsicMetadata(
target=directory_swhid,
authority=metadata_authority,
fetcher=MetadataFetcher(
name="swh.loader.package.maven.loader.MavenLoader", version=__version__,
),
discovery_date=loader.visit_date,
format="maven-pom",
metadata=b"",
origin=MVN_ARTIFACTS[0]["url"],
release=release_swhid,
)
]
> assert swh_storage.raw_extrinsic_metadata_get(
directory_swhid, metadata_authority,
) == PagedResult(next_page_token=None, results=expected_metadata,)
E AssertionError: assert PagedResult(r...ge_token=None) == PagedResult(r...ge_token=None)
E
E Omitting 1 identical items, use -vv to show
E Differing attributes:
E ['results']
E
E Drill down into differing attribute results:
E results: [RawExtrinsicMetadata(target=ExtendedSWHID(namespace='swh', scheme_version=1, object_id=b'l\x9d\xe4\x1eL\xeb\xb9\x1a\x83h\xda\x1d\x89\xae\x98s\xbdT\x0e\xc3', object_type=<ExtendedObjectType.DIRECTORY: 'dir'>), discovery_date=datetime.datetime(2021, 11, 29, 14, 43, tzinfo=datetime.timezone.utc), authority=MetadataAuthority(type=<MetadataAuthorityType.FORGE: 'forge'>, url='https://repo1.maven.org/', metadata=None), fetcher=MetadataFetcher(name=...
E
E ...Full output truncated (8 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/package/maven/tests/test_maven.py:522: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 29 2021, 3:43 PM