Skip to content
Snippets Groups Projects
Commit 3367377c authored by Valentin Rigal's avatar Valentin Rigal
Browse files

Fix tests

parent 18835268
No related branches found
No related tags found
1 merge request!109Handle concurrency while initializing activity
......@@ -71,7 +71,8 @@ def test_readonly(responses, mock_elements_worker):
out = mock_elements_worker.update_activity("1234-deadbeef", ActivityState.Processed)
assert out is None
# update_activity returns False in very specific cases
assert out is True
assert len(responses.calls) == len(BASE_API_CALLS)
assert [
(call.request.method, call.request.url) for call in responses.calls
......@@ -265,7 +266,7 @@ def test_start_activity_conflict(
)
from arkindex_worker.worker import logger
logger.warning = mocker.MagicMock()
logger.info = mocker.MagicMock()
mock_elements_worker_with_list.run()
......@@ -279,14 +280,9 @@ def test_start_activity_conflict(
"http://testserver/api/v1/workers/versions/12341234-1234-1234-1234-123412341234/activity/",
),
]
assert logger.warning.call_args_list == [
mocker.call(
"Failed to update activity of element 1234-deadbeef to started due to an API error: Either this activity does not exists or this state is not allowed."
),
mocker.call(
"Cannot start processing element 1234-deadbeef due to a conflict. "
"Another process could have processed it with the same version already."
),
assert logger.info.call_args_list[:2] == [
mocker.call("Processing page Test Page n°1 (1234-deadbeef) (1/1)"),
mocker.call("Skipping element 1234-deadbeef as it was already processed"),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment