@@ -96,12 +96,23 @@ def test_uma_resource_sets(uma: KeycloakUMA):
96
96
"name" : "mytest" ,
97
97
"scopes" : ["test:read" , "test:write" ],
98
98
"type" : "urn:test" ,
99
+ "uris" : ["/some_resources/*" ],
99
100
}
100
101
created_resource = uma .resource_set_create (resource_to_create )
101
102
assert created_resource
102
103
assert created_resource ["_id" ], created_resource
103
104
assert set (resource_to_create ).issubset (set (created_resource )), created_resource
104
105
106
+ # Test getting resource with wildcard
107
+ # Without matchingUri query option
108
+ resource_set_list_ids = uma .resource_set_list_ids (uri = "/some_resources/resource" )
109
+ assert len (resource_set_list_ids ) == 0
110
+ # With matchingUri query option
111
+ resource_set_list_ids = uma .resource_set_list_ids (
112
+ uri = "/some_resources/resource" , matchingUri = True
113
+ )
114
+ assert len (resource_set_list_ids ) == 1
115
+
105
116
# Test create the same resource set
106
117
with pytest .raises (KeycloakPostError ) as err :
107
118
uma .resource_set_create (resource_to_create )
@@ -382,12 +393,23 @@ async def test_a_uma_resource_sets(uma: KeycloakUMA):
382
393
"name" : "mytest" ,
383
394
"scopes" : ["test:read" , "test:write" ],
384
395
"type" : "urn:test" ,
396
+ "uris" : ["/some_resources/*" ],
385
397
}
386
398
created_resource = await uma .a_resource_set_create (resource_to_create )
387
399
assert created_resource
388
400
assert created_resource ["_id" ], created_resource
389
401
assert set (resource_to_create ).issubset (set (created_resource )), created_resource
390
402
403
+ # Test getting resource with wildcard
404
+ # Without matchingUri query option
405
+ resource_set_list_ids = await uma .a_resource_set_list_ids (uri = "/some_resources/resource" )
406
+ assert len (resource_set_list_ids ) == 0
407
+ # With matchingUri query option
408
+ resource_set_list_ids = await uma .a_resource_set_list_ids (
409
+ uri = "/some_resources/resource" , matchingUri = True
410
+ )
411
+ assert len (resource_set_list_ids ) == 1
412
+
391
413
# Test create the same resource set
392
414
with pytest .raises (KeycloakPostError ) as err :
393
415
await uma .a_resource_set_create (resource_to_create )
0 commit comments