self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7fb5145c4470>
swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7fb461435748>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fb461410eb8>
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)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:2669:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7fb461435748>
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:26 PM