Skip to content

Commit

Permalink
fix mocks in rest_api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Limmen committed Jul 12, 2024
1 parent 8c5c78d commit 2479b8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def test_emulation_traces_ids_delete(self, mocker: pytest_mock.MockFixture, flas
:param list_em_trac: the list_em_trac fixture
:param remove: the remove fixture
"""
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.list_emulation_traces_ids",
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_emulation_trace",
side_effect=get_em_tr)
mocker.patch("csle_rest_api.util.rest_api_util.check_if_user_is_authorized", side_effect=not_logged_in)
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.remove_emulation_trace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ def test_emulation_execution_ids_c_prod_post(self, mocker: pytest_mock.MockFixtu

def test_emulation_execution_ids_dcm_post(self, mocker: pytest_mock.MockFixture, flask_app, not_logged_in,
logged_in, logged_in_as_admin, get_em_ex,
merged_info, start_dcm, stop_dcm) -> None:
merged_info, start_dcm, stop_dcm, config) -> None:
"""
Testing the HTTPS GET method for the /emulation-executions/id/docker-stats-manager resource
Expand All @@ -2182,9 +2182,11 @@ def test_emulation_execution_ids_dcm_post(self, mocker: pytest_mock.MockFixture,
:param get_ex_exec: the get_ex_exec fixture
:param start_dcm: the start_dcm fixture
:param stop_dcm: the stop_dcm fixture
:param config: the config fixture
:return: None
"""
mocker.patch('time.sleep', return_value=None)
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_config", side_effect=config)
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_emulation_execution",
side_effect=get_em_ex)
mocker.patch("csle_cluster.cluster_manager.cluster_controller.ClusterController.get_merged_execution_info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_users_id_get(self, flask_app, mocker: pytest_mock.MockFixture, manageme
assert response.status_code == constants.HTTPS.UNAUTHORIZED_STATUS_CODE

def test_users_id_put(self, flask_app, mocker: pytest_mock.MockFixture, management_users, not_logged_in,
logged_in, authorized, unauthorized, management_config) -> None:
logged_in, authorized, unauthorized, management_config, update) -> None:
"""
Testing the PUT HTTPS method for the /users/id resource
Expand All @@ -338,9 +338,12 @@ def test_users_id_put(self, flask_app, mocker: pytest_mock.MockFixture, manageme
:param remove: the remove fixture
:param logged_in: the logged_in fixture
:param authorized: the athourized fixture
:param unauthorized: the unathourized fixture
:param unauthorized: the unauthorized fixture
:param update: the update fixture
:return: None
"""
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.update_management_user",
side_effect=update)
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.list_management_users",
side_effect=management_users)
mocker.patch("csle_common.metastore.metastore_facade.MetastoreFacade.get_management_user_config",
Expand Down

0 comments on commit 2479b8e

Please sign in to comment.