Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.api.views.test_origin::Tests / Python tests / test_api_lookup_origin_visits_by_id
Failed

TEST RESULT

Run At
Aug 24 2022, 12:08 PM
Details
api_client = <rest_framework.test.APIClient object at 0x7fe756381860> subtest = <function subtest.<locals>.inner at 0x7fe757f24730> @given(new_origin(), visit_dates(3), new_snapshots(3)) > def test_api_lookup_origin_visits_by_id( api_client, subtest, new_origin, visit_dates, new_snapshots ): .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:139: in test_api_lookup_origin_visits_by_id @subtest .tox/py3/lib/python3.7/site-packages/swh/web/tests/conftest.py:1064: in inner item.ihook.pytest_runtest_call(item=item) .tox/py3/lib/python3.7/site-packages/pluggy/_hooks.py:265: in __call__ return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/pluggy/_manager.py:80: in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/_pytest/runner.py:174: in pytest_runtest_call raise e .tox/py3/lib/python3.7/site-packages/_pytest/runner.py:166: in pytest_runtest_call item.runtest() .tox/py3/lib/python3.7/site-packages/_pytest/python.py:1761: in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) .tox/py3/lib/python3.7/site-packages/pluggy/_hooks.py:265: in __call__ return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/pluggy/_manager.py:80: in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/_pytest/python.py:192: in pytest_pyfunc_call result = testfunction(**testargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7fe7105cebe0> @subtest def test_inner(archive_data): archive_data.origin_add([new_origin]) for i, visit_date in enumerate(visit_dates): origin_visit = archive_data.origin_visit_add( [ OriginVisit( origin=new_origin.url, date=visit_date, type="git", ) ] )[0] archive_data.snapshot_add([new_snapshots[i]]) visit_status = OriginVisitStatus( origin=new_origin.url, visit=origin_visit.visit, date=now(), status="full", snapshot=new_snapshots[i].id, ) archive_data.origin_visit_status_add([visit_status]) all_visits = list(reversed(get_origin_visits(new_origin.to_dict()))) for last_visit, expected_visits in ( (None, all_visits[:2]), (all_visits[1]["visit"], all_visits[2:4]), ): url = reverse( "api-1-origin-visits", url_args={"origin_url": new_origin.url}, query_params={"per_page": 2, "last_visit": last_visit}, ) rv = check_api_get_responses(api_client, url, status_code=200) for i in range(len(expected_visits)): expected_visits[i] = enrich_origin_visit( expected_visits[i], with_origin_link=False, with_origin_visit_link=True, request=rv.wsgi_request, ) > assert rv.data == expected_visits E AssertionError: assert [{'date': '20...sit/2/', ...}] == [{'date': '20...sit/1/', ...}] E At index 0 diff: {'origin': 'git://a.0', 'visit': 3, 'date': '2022-08-24T03:00:00+00:00', 'status': 'created', 'snapshot': None, 'type': 'git', 'metadata': {}, 'origin_visit_url': 'http://testserver/api/1/origin/git://a.0/visit/3/', 'snapshot_url': None} != {'origin': 'git://a.0', 'visit': 2, 'date': '2022-08-24T09:56:54.965872+00:00', 'status': 'full', 'snapshot': '6918f60fa43365b4f818ff399dda19642af3dc41', 'type': 'git', 'metadata': {}, 'origin_visit_url': 'http://testserver/api/1/origin/git://a.0/visit/2/', 'snapshot_url': 'http://testserver/api/1/snapshot/6918f60fa4... E E ...Full output truncated (31 lines hidden), use '-vv' to show E Falsifying example: test_api_lookup_origin_visits_by_id( E new_snapshots=[Snapshot(branches=ImmutableDict({b'\x00': None, b'\x01': None}), id=hash_to_bytes('6918f60fa43365b4f818ff399dda19642af3dc41')), E Snapshot(branches=ImmutableDict({b'\x00': None, b'\x01': None}), id=hash_to_bytes('6918f60fa43365b4f818ff399dda19642af3dc41')), E Snapshot(branches=ImmutableDict({b'\x00': None, b'\x01': None}), id=hash_to_bytes('6918f60fa43365b4f818ff399dda19642af3dc41'))], E visit_dates=[datetime.datetime(2015, 1, 1, 0, 0, tzinfo=tzutc()), E datetime.datetime(2015, 1, 1, 0, 0, 0, 1, tzinfo=tzutc()), E datetime.datetime(2022, 8, 24, 3, 0, tzinfo=tzfile('/usr/share/zoneinfo/America/Hermosillo'))], E new_origin=Origin(url='git://a.0', id=b'\x17\x9e\x80\xa4\x8fda\x8e{\xa0\xa9\x14\x82F8\xab\x05\xaa\x95\xbb'), E api_client=<rest_framework.test.APIClient at 0x7fe756381860>, E subtest=inner, E ) .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:185: AssertionError