@@ -46,8 +46,13 @@ async def test_licensed_items_listing(
4646 licensed_resource_name = "Model A" ,
4747 licensed_resource_type = LicensedResourceType .VIP_MODEL ,
4848 pricing_plan_id = pricing_plan_id ,
49- licensed_resource_data = VIP_DETAILS_EXAMPLE ,
49+ licensed_resource_data = {
50+ "categoryId" : "HumanWholeBody" ,
51+ "categoryDisplay" : "Humans" ,
52+ "source" : VIP_DETAILS_EXAMPLE ,
53+ },
5054 )
55+
5156 _licensed_item_id = licensed_item_db .licensed_item_id
5257
5358 # list
@@ -56,12 +61,14 @@ async def test_licensed_items_listing(
5661 data , _ = await assert_status (resp , status .HTTP_200_OK )
5762 assert len (data ) == 1
5863 assert LicensedItemRestGet (** data [0 ])
59- assert data [0 ]["licensedResourceData" ][
60- "additionalField"
61- ] # <-- Testing nested camel case
62- assert data [0 ]["licensedResourceData" ]["features" ][
63- "additionalField"
64- ] # <-- Testing nested camel case
64+
65+ # <-- Testing nested camel case
66+ source = data [0 ]["licensedResourceData" ]["source" ]
67+ assert source ["license" ]
68+
69+ # Testing trimmed
70+ assert "additionalField" not in source ["features" ]
71+ assert "additional_field" not in source ["features" ]
6572
6673 # get
6774 url = client .app .router ["get_licensed_item" ].url_for (
@@ -77,17 +84,13 @@ def mock_licensed_items_purchase_functions(mocker: MockerFixture) -> tuple:
7784 mock_wallet_credits = mocker .patch (
7885 "simcore_service_webserver.licenses._licensed_items_service.get_wallet_with_available_credits_by_user_and_wallet" ,
7986 spec = True ,
80- return_value = WalletGetWithAvailableCredits .model_validate (
81- WalletGetWithAvailableCredits .model_config ["json_schema_extra" ]["examples" ][
82- 0
83- ]
84- ),
87+ return_value = WalletGetWithAvailableCredits .model_json_schema ()["examples" ][0 ],
8588 )
8689 mock_get_pricing_unit = mocker .patch (
8790 "simcore_service_webserver.licenses._licensed_items_service.get_pricing_plan_unit" ,
8891 spec = True ,
8992 return_value = PricingUnitGet .model_validate (
90- PricingUnitGet .model_config [ "json_schema_extra" ] ["examples" ][0 ]
93+ PricingUnitGet .model_json_schema () ["examples" ][0 ]
9194 ),
9295 )
9396 mock_create_licensed_item_purchase = mocker .patch (
@@ -121,7 +124,11 @@ async def test_licensed_items_purchase(
121124 licensed_resource_name = "Model A" ,
122125 licensed_resource_type = LicensedResourceType .VIP_MODEL ,
123126 pricing_plan_id = pricing_plan_id ,
124- licensed_resource_data = VIP_DETAILS_EXAMPLE ,
127+ licensed_resource_data = {
128+ "categoryId" : "HumanWholeBody" ,
129+ "categoryDisplay" : "Humans" ,
130+ "source" : VIP_DETAILS_EXAMPLE ,
131+ },
125132 )
126133 _licensed_item_id = licensed_item_db .licensed_item_id
127134
0 commit comments