Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_cassandra.TestCassandraStorage::test_origin_visit_status_add_twice
Failed

TEST RESULT

Run At
Jun 22 2020, 5:12 PM
Details
self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f81c04d02e8> swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f81c04d0400> def test_origin_visit_status_add_twice(self, swh_storage): """Correct origin visit statuses should add a new visit status """ origin1 = Origin.from_dict(data.origin2) swh_storage.origin_add([origin1]) ov1 = swh_storage.origin_visit_add( [ OriginVisit( origin=origin1.url, date=data.date_visit1, type=data.type_visit1, status="ongoing", snapshot=None, ), ] )[0] snapshot_id = data.snapshot["id"] date_visit_now = now() visit_status1 = OriginVisitStatus( origin=ov1.origin, visit=ov1.visit, date=date_visit_now, status="full", snapshot=snapshot_id, ) swh_storage.origin_visit_status_add([visit_status1]) # second call will ignore existing entries (will send to storage though) swh_storage.origin_visit_status_add([visit_status1]) origin_visits = list(swh_storage.origin_visit_get(ov1.origin)) assert len(origin_visits) == 1 origin_visit1 = origin_visits[0] assert origin_visit1 assert origin_visit1["status"] == "full" assert origin_visit1["snapshot"] == snapshot_id actual_objects = list(swh_storage.journal_writer.journal.objects) expected_origins = [origin1] expected_visits = [ov1] expected_visit_statuses = [] for visit in expected_visits: # out of origin-visit-add calls visit_status = visit.to_dict() visit_status.pop("type") expected_visit_statuses.append(OriginVisitStatus.from_dict(visit_status)) # write twice in the journal expected_visit_statuses += [visit_status1] * 2 expected_objects = ( [("origin", o) for o in expected_origins] + [("origin_visit", v) for v in expected_visits] + [("origin_visit_status", ovs) for ovs in expected_visit_statuses] ) > assert len(actual_objects) == len(expected_objects) E assert 6 == 5 E +6 E -5 .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1883: AssertionError