Skip to content

Commit 2479b8e

Browse files
committed
fix mocks in rest_api tests
1 parent 8c5c78d commit 2479b8e

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

simulation-system/libs/csle-rest-api/tests/test_resources_emulation_traces.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def test_emulation_traces_ids_delete(self, mocker: pytest_mock.MockFixture, flas
309309
:param list_em_trac: the list_em_trac fixture
310310
:param remove: the remove fixture
311311
"""
312-
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.list_emulation_traces_ids",
312+
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_emulation_trace",
313313
side_effect=get_em_tr)
314314
mocker.patch("csle_rest_api.util.rest_api_util.check_if_user_is_authorized", side_effect=not_logged_in)
315315
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.remove_emulation_trace",

simulation-system/libs/csle-rest-api/tests/test_resources_emulations_executions.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ def test_emulation_execution_ids_c_prod_post(self, mocker: pytest_mock.MockFixtu
21682168

21692169
def test_emulation_execution_ids_dcm_post(self, mocker: pytest_mock.MockFixture, flask_app, not_logged_in,
21702170
logged_in, logged_in_as_admin, get_em_ex,
2171-
merged_info, start_dcm, stop_dcm) -> None:
2171+
merged_info, start_dcm, stop_dcm, config) -> None:
21722172
"""
21732173
Testing the HTTPS GET method for the /emulation-executions/id/docker-stats-manager resource
21742174
@@ -2182,9 +2182,11 @@ def test_emulation_execution_ids_dcm_post(self, mocker: pytest_mock.MockFixture,
21822182
:param get_ex_exec: the get_ex_exec fixture
21832183
:param start_dcm: the start_dcm fixture
21842184
:param stop_dcm: the stop_dcm fixture
2185+
:param config: the config fixture
21852186
:return: None
21862187
"""
21872188
mocker.patch('time.sleep', return_value=None)
2189+
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_config", side_effect=config)
21882190
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_emulation_execution",
21892191
side_effect=get_em_ex)
21902192
mocker.patch("csle_cluster.cluster_manager.cluster_controller.ClusterController.get_merged_execution_info",

simulation-system/libs/csle-rest-api/tests/test_resources_users.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def test_users_id_get(self, flask_app, mocker: pytest_mock.MockFixture, manageme
325325
assert response.status_code == constants.HTTPS.UNAUTHORIZED_STATUS_CODE
326326

327327
def test_users_id_put(self, flask_app, mocker: pytest_mock.MockFixture, management_users, not_logged_in,
328-
logged_in, authorized, unauthorized, management_config) -> None:
328+
logged_in, authorized, unauthorized, management_config, update) -> None:
329329
"""
330330
Testing the PUT HTTPS method for the /users/id resource
331331
@@ -338,9 +338,12 @@ def test_users_id_put(self, flask_app, mocker: pytest_mock.MockFixture, manageme
338338
:param remove: the remove fixture
339339
:param logged_in: the logged_in fixture
340340
:param authorized: the athourized fixture
341-
:param unauthorized: the unathourized fixture
341+
:param unauthorized: the unauthorized fixture
342+
:param update: the update fixture
342343
:return: None
343344
"""
345+
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.update_management_user",
346+
side_effect=update)
344347
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.list_management_users",
345348
side_effect=management_users)
346349
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_management_user_config",

0 commit comments

Comments
 (0)