Skip to content

Commit 79e55b4

Browse files
committed
More thorough test of 'post_transfer' behaviour for Maps workflow
1 parent 2f63156 commit 79e55b4

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

tests/client/contexts/test_fib.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
from unittest import mock
23
from unittest.mock import MagicMock
34

45
import pytest
@@ -198,9 +199,7 @@ def test_fib_maps_context(
198199
mock_file_transferred_to = mocker.patch(
199200
"murfey.client.contexts.fib._file_transferred_to", side_effect=destination_files
200201
)
201-
mock_register_fib_atlas = mocker.patch.object(
202-
FIBContext, "_register_atlas", return_value=True
203-
)
202+
mock_capture_post = mocker.patch("murfey.client.contexts.fib.capture_post")
204203

205204
# Initialise the FIBContext
206205
basepath = tmp_path
@@ -212,7 +211,7 @@ def test_fib_maps_context(
212211
)
213212

214213
# Parse images one-by-one
215-
for file in fib_maps_images:
214+
for f, file in enumerate(fib_maps_images):
216215
context.post_transfer(file, environment=mock_environment)
217216
mock_get_source.assert_called_with(file, mock_environment)
218217
mock_file_transferred_to.assert_called_with(
@@ -221,11 +220,13 @@ def test_fib_maps_context(
221220
file_path=file,
222221
rsync_basepath=Path(""),
223222
)
224-
assert mock_register_fib_atlas.call_count == len(fib_maps_images)
225-
for dst in destination_files:
226-
mock_register_fib_atlas.assert_any_call(
227-
dst,
228-
mock_environment,
223+
mock_capture_post.assert_called_with(
224+
base_url=mock.ANY,
225+
router_name="workflow_fib.router",
226+
function_name="register_fib_atlas",
227+
token="",
228+
data={"file": str(destination_files[f])},
229+
session_id=mock.ANY,
229230
)
230231

231232

0 commit comments

Comments
 (0)