self = <swh.storage.tests.test_api_client.TestStorage object at 0x7fb5f839d128>
swh_storage = <RemoteStorage url=mock://example.com/>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fb5f83b48d0>
def test_snapshot_add_get(self, swh_storage, sample_data):
snapshot = sample_data.snapshot
origin = sample_data.origin
swh_storage.origin_add([origin])
visit = OriginVisit(
origin=origin.url,
date=sample_data.date_visit1,
type=sample_data.type_visit1,
)
origin_visit1 = swh_storage.origin_visit_add([visit])[0]
visit_id = origin_visit1.visit
swh_storage.snapshot_add([snapshot])
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin.url,
visit=origin_visit1.visit,
date=now(),
status="ongoing",
snapshot=snapshot.id,
)
]
)
expected_snapshot = {**snapshot.to_dict(), "next_branch": None}
by_id = swh_storage.snapshot_get(snapshot.id)
assert by_id == expected_snapshot
by_ov = swh_storage.snapshot_get_by_origin_visit(origin.url, visit_id)
assert by_ov == expected_snapshot
origin_visit_info = swh_storage.origin_visit_get_by(origin.url, visit_id)
> assert origin_visit_info["snapshot"] == snapshot.id
E TypeError: 'OriginVisit' object is not subscriptable
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:2673: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 27 2020, 2:26 PM