self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f2ddc5d8588>
swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f2dfc6b8da0>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f2dfc147320>
def test_snapshot_add_get_complete(self, swh_storage, sample_data):
complete_snapshot = sample_data.snapshots[2]
complete_snapshot_dict = complete_snapshot.to_dict()
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
actual_result = swh_storage.snapshot_add([complete_snapshot])
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin.url,
visit=origin_visit1.visit,
date=now(),
status="ongoing",
snapshot=complete_snapshot.id,
)
]
)
assert actual_result == {"snapshot:add": 1}
by_id = swh_storage.snapshot_get(complete_snapshot.id)
assert by_id == {**complete_snapshot_dict, "next_branch": None}
> by_ov = swh_storage.snapshot_get_by_origin_visit(origin.url, visit_id)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:2341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f2dfc6b8da0>
origin = 'https://github.com/user1/repo1'
visit = OriginVisit(origin='https://github.com/user1/repo1', date=datetime.datetime(2015, 1, 1, 23, 0, tzinfo=datetime.timezone.utc), type='git', visit=1)
def snapshot_get_by_origin_visit(self, origin, visit):
try:
visit = self.origin_visit_get_by(origin, visit)
except IndexError:
return None
> return self.snapshot_get(visit["snapshot"])
E TypeError: 'OriginVisit' object is not subscriptable
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:589: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 27 2020, 2:33 PM