Skip to content

Commit 03d2188

Browse files
committed
Use the actual MachineConfig instead of a MagicMock object
1 parent f97edfa commit 03d2188

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

tests/server/api/test_file_io_instrument.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
make_rsyncer_destination,
1111
suggest_path,
1212
)
13+
from murfey.util.config import MachineConfig
1314

1415

1516
@pytest.mark.parametrize(
@@ -58,13 +59,16 @@ def test_suggest_path(
5859
mock_db.exec.return_value.one.return_value = mock_session
5960

6061
# Mock 'get_machine_config'
61-
mock_machine_config = MagicMock()
62-
mock_machine_config.rsync_basepath = rsync_basepath
63-
mock_machine_config.mkdir_chmod = 0o775
62+
machine_config = MachineConfig(
63+
**{
64+
"rsync_basepath": str(rsync_basepath),
65+
"mkdir_chmod": "0o775",
66+
}
67+
)
6468
mocker.patch(
6569
"murfey.server.api.file_io_instrument.get_machine_config",
6670
return_value={
67-
instrument_name: mock_machine_config,
71+
instrument_name: machine_config,
6872
},
6973
)
7074

@@ -133,13 +137,16 @@ def test_make_rsyncer_destination(
133137
mock_db.exec.return_value.one.return_value = mock_session
134138

135139
# Mock 'get_machine_config'
136-
mock_machine_config = MagicMock()
137-
mock_machine_config.rsync_basepath = rsync_basepath
138-
mock_machine_config.mkdir_chmod = 0o775
140+
machine_config = MachineConfig(
141+
**{
142+
"rsync_basepath": str(rsync_basepath),
143+
"mkdir_chmod": "0o775",
144+
}
145+
)
139146
mocker.patch(
140147
"murfey.server.api.file_io_instrument.get_machine_config",
141148
return_value={
142-
instrument_name: mock_machine_config,
149+
instrument_name: machine_config,
143150
},
144151
)
145152

0 commit comments

Comments
 (0)