Skip to content

Commit

Permalink
finish test
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Oct 19, 2023
1 parent 82bf2f4 commit 23537ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions services/api-server/tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())


Expand Down
7 changes: 6 additions & 1 deletion services/api-server/tests/unit/test_api_solver_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -211,3 +215,4 @@ def _start_job_side_effect(
},
)
assert response.status_code == 200
assert _put_pricing_plan_and_unit_side_effect.was_called

0 comments on commit 23537ea

Please sign in to comment.