3737from servicelib .rabbitmq .rpc_interfaces .resource_usage_tracker .errors import (
3838 CanNotCheckoutNotEnoughAvailableSeatsError ,
3939 CanNotCheckoutServiceIsNotRunningError ,
40+ LicensedItemCheckoutNotFoundError ,
4041 NotEnoughAvailableSeatsError ,
4142)
4243from simcore_service_api_server ._meta import API_VTAG
@@ -244,17 +245,21 @@ async def side_effect(
244245
245246
246247@pytest .mark .parametrize (
247- "backend_exception_to_raise ,expected_api_server_status_code,valid_license_checkout_id" ,
248+ "wb_api_exception_to_raise,rut_exception_to_raise ,expected_api_server_status_code,valid_license_checkout_id" ,
248249 [
249- (None , status .HTTP_200_OK , True ),
250+ (LicensedItemCheckoutNotFoundError , None , status .HTTP_404_NOT_FOUND , True ),
251+ (None , LicensedItemCheckoutNotFoundError , status .HTTP_404_NOT_FOUND , True ),
252+ (None , None , status .HTTP_200_OK , True ),
253+ (None , None , status .HTTP_422_UNPROCESSABLE_ENTITY , False ),
250254 ],
251255)
252256async def test_release_checked_out_licensed_item (
253257 mock_wb_api_server_rcp : MockerFixture ,
254258 mock_rut_rpc : MockerFixture ,
255259 client : AsyncClient ,
256260 auth : BasicAuth ,
257- backend_exception_to_raise : Exception | None ,
261+ wb_api_exception_to_raise : Exception | None ,
262+ rut_exception_to_raise : Exception | None ,
258263 expected_api_server_status_code : int ,
259264 valid_license_checkout_id : bool ,
260265 faker : Faker ,
@@ -267,8 +272,8 @@ async def get_licensed_item_checkout(
267272 product_name : str ,
268273 licensed_item_checkout_id : LicensedItemCheckoutID ,
269274 ) -> LicensedItemCheckoutGet :
270- if backend_exception_to_raise is not None :
271- raise backend_exception_to_raise
275+ if rut_exception_to_raise is not None :
276+ raise rut_exception_to_raise
272277 extra = LicensedItemCheckoutGet .model_config .get ("json_schema_extra" )
273278 assert isinstance (extra , dict )
274279 examples = extra .get ("examples" )
@@ -287,8 +292,8 @@ async def release_licensed_item_for_wallet(
287292 user_id : int ,
288293 licensed_item_checkout_id : LicensedItemCheckoutID ,
289294 ) -> LicensedItemCheckoutRpcGet :
290- if backend_exception_to_raise is not None :
291- raise backend_exception_to_raise
295+ if wb_api_exception_to_raise is not None :
296+ raise wb_api_exception_to_raise
292297 extra = LicensedItemCheckoutRpcGet .model_config .get ("json_schema_extra" )
293298 assert isinstance (extra , dict )
294299 examples = extra .get ("examples" )
0 commit comments