swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7fa5d60f1518>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fa5d60faa20>
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()
print(f"LOAD STATUS {actual_load_status.items()}")
print(f"LOAD STATUS {actual_load_status.keys()}")
# FAIL should be eventful
assert actual_load_status["status"] == "uneventful"
expected_snapshot_first_visit_id = hash_to_bytes(
"1a8893e6a86f444e8be8e7bda6cb34fb1735a00e"
)
assert (
hash_to_bytes(actual_load_status["snapshot_id"])
== expected_snapshot_first_visit_id
)
print(f"Debug actual load status {actual_load_status}")
stats = get_stats(swh_storage)
print(f"Debug stats {stats}")
# FAIL status should be full
assert_last_visit_matches(
swh_storage, MVN_ARTIFACTS[0]["url"], status="partial", type="jar"
)
> assert {
"content": len(_expected_new_contents_first_visit),
"directory": len(_expected_new_directories_first_visit),
"origin": 1,
"origin_visit": 1,
"release": 0,
"revision": len(_expected_new_revisions_first_visit),
"skipped_content": 0,
"snapshot": 1,
} == stats
E AssertionError: assert {'content': 2...isit': 1, ...} == {'content': 2...isit': 1, ...}
E Omitting 7 identical items, use -vv to show
E Differing items:
E {'revision': 1} != {'revision': 0}
E Full diff:
E {
E 'content': 26,
E 'directory': 9,...
E
E ...Full output truncated (11 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/package/jar/tests/test_jar.py:175: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 30 2021, 10:36 AM