From 23537ea73c63db6a4fa57375da27b17897bf611e Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Thu, 19 Oct 2023 23:31:45 +0200 Subject: [PATCH] finish test --- services/api-server/tests/unit/conftest.py | 7 +++++++ services/api-server/tests/unit/test_api_solver_jobs.py | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/services/api-server/tests/unit/conftest.py b/services/api-server/tests/unit/conftest.py index 6d2fd5c0187..bf68dc27b45 100644 --- a/services/api-server/tests/unit/conftest.py +++ b/services/api-server/tests/unit/conftest.py @@ -143,6 +143,13 @@ def auth(mocker, app: FastAPI, faker: Faker) -> HTTPBasicAuth: return_value="osparc", ) + # patches simcore_postgres_database.utils_groups_extra_properties.GroupExtraPropertiesRepo.get_aggregated_properties_for_user + mocker.patch( + "simcore_service_api_server.db.repositories.groups_extra_properties.GroupsExtraPropertiesRepository.use_on_demand_clusters", + autospec=True, + return_value=False, + ) + return HTTPBasicAuth(faker.word(), faker.password()) diff --git a/services/api-server/tests/unit/test_api_solver_jobs.py b/services/api-server/tests/unit/test_api_solver_jobs.py index f4e58eae5d2..f50fdb2fec8 100644 --- a/services/api-server/tests/unit/test_api_solver_jobs.py +++ b/services/api-server/tests/unit/test_api_solver_jobs.py @@ -181,6 +181,7 @@ def _put_pricing_plan_and_unit_side_effect( path_params: dict[str, Any], capture: HttpApiCallCaptureModel, ) -> Any: + _put_pricing_plan_and_unit_side_effect.was_called = True assert int(path_params["pricing_plan_id"]) == _pricing_plan_id assert int(path_params["pricing_unit_id"]) == _pricing_unit_id return capture.response_body @@ -190,8 +191,11 @@ def _start_job_side_effect( path_params: dict[str, Any], capture: HttpApiCallCaptureModel, ) -> Any: - return capture.response_body + response = capture.response_body + response["id"] = _job_id + return response + _put_pricing_plan_and_unit_side_effect.was_called = False respx_mock = respx_mock_from_capture( [mocked_webserver_service_api_base] * 2 + [mocked_directorv2_service_api_base], project_tests_dir / "mocks" / "start_job_with_payment.json", @@ -211,3 +215,4 @@ def _start_job_side_effect( }, ) assert response.status_code == 200 + assert _put_pricing_plan_and_unit_side_effect.was_called