swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7f65cf16b4e0>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f65cf15b208>
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'
data_pom_1 = b'<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven....actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
def test_metadatata(swh_storage, requests_mock, data_jar_1, data_pom_1):
"""With no prior visit, loading a jar ends up with 1 snapshot.
Extrinsic metadata is the pom file associated to the source jar.
"""
requests_mock.get(MVN_ARTIFACTS[0]["url"], content=data_jar_1)
requests_mock.get(MVN_ARTIFACTS_POM[0], content=data_pom_1)
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=_expected_pom_metadata.encode(),
origin=MVN_ARTIFACTS[0]["url"],
release=release_swhid,
),
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-json",
metadata=json.dumps(_expected_json_metadata).encode(),
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, 12, 1, 12, 39, 19, tzinfo=datetime.timezone.utc), authority=MetadataAuthority(type=<MetadataAuthorityType.FORGE: 'forge'>, url='https://repo1.maven.org/', metadata=None), fetcher=MetadataFetcher(na...
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:472: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Dec 1 2021, 1:39 PM