2626)
2727from simcore_service_webserver .licenses ._itis_vip_service import ResponseData
2828from simcore_service_webserver .licenses ._itis_vip_settings import ItisVipSettings
29+ from simcore_service_webserver .licenses ._licensed_items_service import RegistrationState
2930
3031
3132def test_pre_validator_feature_descriptor_to_dict ():
@@ -148,6 +149,8 @@ async def test_sync_itis_vip_as_licensed_items(
148149 assert items [0 ].features ["functionality" ] == "Posable"
149150
150151 for vip_item in items :
152+
153+ # register a NEW resource
151154 (
152155 got1 ,
153156 state1 ,
@@ -158,10 +161,9 @@ async def test_sync_itis_vip_as_licensed_items(
158161 licensed_resource_data = vip_item ,
159162 license_key = vip_item .license_key ,
160163 )
161- assert (
162- state1 == _licensed_items_service .RegistrationState .NEWLY_REGISTERED
163- )
164+ assert state1 == RegistrationState .NEWLY_REGISTERED
164165
166+ # register the SAME resource
165167 (
166168 got2 ,
167169 state2 ,
@@ -173,35 +175,27 @@ async def test_sync_itis_vip_as_licensed_items(
173175 license_key = vip_item .license_key ,
174176 )
175177
176- assert (
177- state2
178- == _licensed_items_service .RegistrationState .ALREADY_REGISTERED
179- )
178+ assert state2 == RegistrationState .ALREADY_REGISTERED
180179 assert got1 == got2
181180
182- # Modify vip_item and register again
183- vip_item_modified = vip_item .model_copy (
184- update = {
185- "features" : {
186- ** vip_item .features ,
187- "functionality" : "Non-Posable" ,
188- }
189- }
190- )
181+ # register a MODIFIED version of the same resource
191182 (
192183 got3 ,
193184 state3 ,
194185 ) = await _licensed_items_service .register_resource_as_licensed_item (
195186 client .app ,
196187 licensed_resource_name = f"{ category } /{ vip_item .id } " ,
197188 licensed_resource_type = LicensedResourceType .VIP_MODEL ,
198- licensed_resource_data = vip_item_modified ,
189+ licensed_resource_data = vip_item .model_copy (
190+ update = {
191+ "features" : {
192+ ** vip_item .features ,
193+ "functionality" : "Non-Posable" ,
194+ }
195+ }
196+ ),
199197 license_key = vip_item .license_key ,
200198 )
201199
202- assert (
203- state3
204- == _licensed_items_service .RegistrationState .DIFFERENT_RESOURCE
205- )
206- # not stored!
200+ assert state3 == RegistrationState .DIFFERENT_RESOURCE
207201 assert got2 == got3
0 commit comments