swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7f166e598b00>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f166e54a978>
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_jar_visit_with_release_artifact_no_prior_visit(
swh_storage, requests_mock, data_jar_1
):
"""With no prior visit, loading a jar ends up with 1 snapshot
"""
requests_mock.get(MVN_ARTIFACTS[0]["url"], content=data_jar_1)
loader = JarLoader(
swh_storage, MVN_ARTIFACTS[0]["url"], artifacts=[MVN_ARTIFACTS[0]]
)
actual_load_status = loader.load()
assert actual_load_status["status"] == "eventful"
expected_snapshot_first_visit_id = hash_to_bytes(
"677b0280cbe9e650c9dfa80fbb1ab7ebb1603c86"
)
expected_snapshot = Snapshot(
id=expected_snapshot_first_visit_id,
branches={
b"HEAD": SnapshotBranch(
target_type=TargetType.ALIAS, target=b"releases/0.1.0",
),
b"releases/0.1.0": SnapshotBranch(
target_type=TargetType.REVISION,
target=hash_to_bytes("b7cd10479d3639a813b444d2ccfbdaa0b2613690"),
),
},
)
actual_snapshot = snapshot_get_all_branches(
swh_storage, hash_to_bytes(actual_load_status["snapshot_id"])
)
print(f"actual_snapshot is {actual_snapshot}.")
print(f" * id is {actual_snapshot.id.hex()}.")
print(f" * br HEAD is {actual_snapshot.branches[b'HEAD'].target}.")
print(f" * br rel is {actual_snapshot.branches[b'releases/0.1.0'].target.hex()}.")
> assert actual_snapshot == expected_snapshot
E AssertionError: assert Snapshot(bran...2J\x11%/\x83') == Snapshot(bran...eb\xb1`<\x86')
E
E Differing attributes:
E ['branches', 'id']
E
E Drill down into differing attribute branches:
E branches: ImmutableDict({b'HEAD': SnapshotBranch(target=b'releases/0.1.0', target_type=<TargetType.ALIAS: 'alias'>), b'releases/0.1.0': SnapshotBranch(target=b'g\x94\x90I\xe9\x00!\x1d\xb0l\xfd\x1cGLj\xd4\r#\xc1\x86', target_type=<TargetType.REVISION: 'revision'>)}) != ImmutableDict({b'HEAD': SnapshotBranch(target=b'releases/0.1.0', target_type=<TargetType.ALIAS: 'alias'>), b'releases/0.1.0': SnapshotBranch(target=b'\xb7\xcd\x10G\x9d69\xa8\x13\xb4D\xd2\xcc\xfb\xda\xa0\xb2a6\x90', target...
E
E ...Full output truncated (15 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/package/jar/tests/test_jar.py:188: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Sep 3 2021, 4:02 PM