self = <swh.storage.tests.test_storage.TestStorage object at 0x7f755c7f6cf8>
swh_storage = <swh.storage.in_memory.InMemoryStorage object at 0x7f755f175198>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f755fa546d8>
def test_origin_visit_add(self, swh_storage, sample_data):
origin1 = sample_data.origins[1]
swh_storage.origin_add([origin1])
date_visit = now()
date_visit2 = date_visit + datetime.timedelta(minutes=1)
date_visit = round_to_milliseconds(date_visit)
date_visit2 = round_to_milliseconds(date_visit2)
visit1 = OriginVisit(
origin=origin1.url, date=date_visit, type=sample_data.type_visit1,
)
visit2 = OriginVisit(
origin=origin1.url, date=date_visit2, type=sample_data.type_visit2,
)
# add once
ov1, ov2 = swh_storage.origin_visit_add([visit1, visit2])
# then again (will be ignored as they already exist)
origin_visit1, origin_visit2 = swh_storage.origin_visit_add([ov1, ov2])
assert ov1 == origin_visit1
assert ov2 == origin_visit2
ovs1 = OriginVisitStatus(
origin=origin1.url,
visit=ov1.visit,
date=date_visit,
status="created",
snapshot=None,
)
ovs2 = OriginVisitStatus(
origin=origin1.url,
visit=ov2.visit,
date=date_visit2,
status="created",
snapshot=None,
)
actual_origin_visits = list(swh_storage.origin_visit_get(origin1.url))
expected_visits = [
{**ovs1.to_dict(), "type": ov1.type},
{**ovs2.to_dict(), "type": ov2.type},
]
> assert len(expected_visits) == len(actual_origin_visits)
E assert 2 == 1
E +2
E -1
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1583: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 27 2020, 10:30 PM