mocker = <pytest_mock.plugin.MockerFixture object at 0x7f4b18d86198>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f4b18d86278>
api_client = <rest_framework.test.APIClient object at 0x7f4b18e85080>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f4b18d86470>
@pytest.mark.django_db
def test_refresh_in_progress_save_request_statuses(
mocker, swh_scheduler, api_client, archive_data
):
"""Refresh a pending save origins requests and update if the status changes
"""
date_now = datetime.now(tz=timezone.utc)
date_pivot = date_now - timedelta(days=30)
visit_started_date = date_now - timedelta(minutes=1)
# returned visit status
SaveOriginRequest.objects.create(
request_date=datetime.now(tz=timezone.utc),
visit_type=_visit_type,
visit_status=VISIT_STATUS_CREATED,
origin_url=_origin_url,
status=SAVE_REQUEST_ACCEPTED,
visit_date=None,
loading_task_id=_task_id,
)
# mock scheduler and archives
_fill_scheduler_db(
swh_scheduler,
task_status="next_run_scheduled",
task_run_status=SAVE_TASK_SCHEDULED,
)
mock_archive = mocker.patch("swh.web.common.origin_save.archive")
mock_archive.lookup_origin.return_value = {"url": _origin_url}
mock_get_origin_visits = mocker.patch(
> "swh.web.common.origin_save.get_origin_visits"
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_origin_save.py:591:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:384: in __call__
**kwargs
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:183: in _start_patch
mocked = p.start() # type: unittest.mock.MagicMock
/usr/lib/python3.7/unittest/mock.py:1399: in start
result = self.__enter__()
/usr/lib/python3.7/unittest/mock.py:1268: in __enter__
original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.mock._patch object at 0x7f4b19158898>
def get_original(self):
target = self.getter()
name = self.attribute
original = DEFAULT
local = False
try:
original = target.__dict__[name]
except (AttributeError, KeyError):
original = getattr(target, name, DEFAULT)
else:
local = True
if name in _builtins and isinstance(target, ModuleType):
self.create = True
if not self.create and original is DEFAULT:
raise AttributeError(
> "%s does not have the attribute %r" % (target, name)
)
E AttributeError: <module 'swh.web.common.origin_save' from '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff@2/.tox/py3/lib/python3.7/site-packages/swh/web/common/origin_save.py'> does not have the attribute 'get_origin_visits'
/usr/lib/python3.7/unittest/mock.py:1242: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Feb 3 2022, 6:35 PM