self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f37813bf518>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f369c377780>
def test_origin_visit_get_by(self, swh_storage):
origin_url = swh_storage.origin_add_one(data.origin)
origin_url2 = swh_storage.origin_add_one(data.origin2)
visit = OriginVisit(
origin=origin_url,
date=data.date_visit2,
type=data.type_visit2,
status="ongoing",
snapshot=None,
)
origin_visit1 = swh_storage.origin_visit_add([visit])[0]
swh_storage.snapshot_add([data.snapshot])
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin_url,
visit=origin_visit1.visit,
date=now(),
status="ongoing",
snapshot=data.snapshot["id"],
)
]
)
# Add some other {origin, visit} entries
visit2 = OriginVisit(
origin=origin_url,
date=data.date_visit3,
type=data.type_visit3,
status="ongoing",
snapshot=None,
)
visit3 = OriginVisit(
origin=origin_url2,
date=data.date_visit3,
type=data.type_visit3,
status="ongoing",
snapshot=None,
)
swh_storage.origin_visit_add([visit2, visit3])
# when
visit1_metadata = {
"contents": 42,
"directories": 22,
}
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin_url,
visit=origin_visit1.visit,
date=now(),
status="full",
snapshot=data.snapshot["id"],
metadata=visit1_metadata,
)
]
)
expected_origin_visit = origin_visit1.to_dict()
expected_origin_visit.update(
{
"origin": origin_url,
"visit": origin_visit1.visit,
"date": data.date_visit2,
"type": data.type_visit2,
"metadata": visit1_metadata,
"status": "full",
"snapshot": data.snapshot["id"],
}
)
# when
actual_origin_visit1 = swh_storage.origin_visit_get_by(
> origin_url, origin_visit1.visit
)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1980:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:921: in origin_visit_get_by
return self._origin_visit_apply_last_status(visit_)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f36bc794898>
visit = {'date': datetime.datetime(2017, 1, 1, 23, 0, tzinfo=datetime.timezone.utc), 'metadata': None, 'origin': 'file:///dev/null', 'snapshot': None, ...}
def _origin_visit_apply_last_status(self, visit: Dict[str, Any]) -> Dict[str, Any]:
"""Retrieve the latest visit status information for the origin visit.
Then merge it with the visit and return it.
"""
> visit_status = self._cql_runner.origin_visit_status_get_latest(
visit["origin"], visit["visit"]
)
E AttributeError: 'CqlRunner' object has no attribute 'origin_visit_status_get_latest'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:866: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jun 17 2020, 10:13 AM