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

Fix tests

parent 18835268
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,8 @@ def test_readonly(responses, mock_elements_worker): ...@@ -71,7 +71,8 @@ def test_readonly(responses, mock_elements_worker):
out = mock_elements_worker.update_activity("1234-deadbeef", ActivityState.Processed) 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 len(responses.calls) == len(BASE_API_CALLS)
assert [ assert [
(call.request.method, call.request.url) for call in responses.calls (call.request.method, call.request.url) for call in responses.calls
...@@ -265,7 +266,7 @@ def test_start_activity_conflict( ...@@ -265,7 +266,7 @@ def test_start_activity_conflict(
) )
from arkindex_worker.worker import logger from arkindex_worker.worker import logger
logger.warning = mocker.MagicMock() logger.info = mocker.MagicMock()
mock_elements_worker_with_list.run() mock_elements_worker_with_list.run()
...@@ -279,13 +280,12 @@ def test_start_activity_conflict( ...@@ -279,13 +280,12 @@ def test_start_activity_conflict(
"http://testserver/api/v1/workers/versions/12341234-1234-1234-1234-123412341234/activity/", "http://testserver/api/v1/workers/versions/12341234-1234-1234-1234-123412341234/activity/",
), ),
] ]
assert logger.warning.call_args_list == [ assert logger.info.call_args_list[:2] == [
mocker.call( 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." "Processing page Test Page n°1 (1234-deadbeef) (1/1)"
), ),
mocker.call( mocker.call(
"Cannot start processing element 1234-deadbeef due to a conflict. " "Skipping element 1234-deadbeef as it was already processed"
"Another process could have processed it with the same version already."
), ),
] ]
......
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