Skip to content

Commit

Permalink
mock the mkdir method in the Parameter constructor method in the Test…
Browse files Browse the repository at this point in the history
…ParameterMock
  • Loading branch information
MAfarrag committed Jan 6, 2025
1 parent 0ec4ccb commit 39c4e7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/rrm/parameters/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def test_download_files(self, parameter_manager, mock_api_client, tmp_path):
]
}

with patch("Hapi.parameters.parameters.FileManager.download_file") as mock_download:
with patch(
"Hapi.parameters.parameters.FileManager.download_file"
) as mock_download:
parameter_manager.download_files(set_id=1, download_dir=tmp_path)

mock_api_client.send_request.assert_called_once_with("GET", "articles/19999901")
Expand Down Expand Up @@ -376,7 +378,9 @@ def mock_file_manager(self):
@pytest.fixture
def parameter(self, mock_parameter_manager):
"""Fixture to provide a Parameter instance with a mocked ParameterManager."""
with patch("os.getenv", return_value="/mocked/path/to/data"):
with patch("os.getenv", return_value="/mocked/path/to/data"), patch(
"pathlib.Path.mkdir", return_value=None
):
parameter_instance = Parameter(version=1)
parameter_instance.manager = mock_parameter_manager
return parameter_instance
Expand Down

0 comments on commit 39c4e7b

Please sign in to comment.