|
@ -96,12 +96,23 @@ def test_uma_resource_sets(uma: KeycloakUMA): |
|
|
"name": "mytest", |
|
|
"name": "mytest", |
|
|
"scopes": ["test:read", "test:write"], |
|
|
"scopes": ["test:read", "test:write"], |
|
|
"type": "urn:test", |
|
|
"type": "urn:test", |
|
|
|
|
|
"uris": ["/some_resources/*"], |
|
|
} |
|
|
} |
|
|
created_resource = uma.resource_set_create(resource_to_create) |
|
|
created_resource = uma.resource_set_create(resource_to_create) |
|
|
assert created_resource |
|
|
assert created_resource |
|
|
assert created_resource["_id"], created_resource |
|
|
assert created_resource["_id"], created_resource |
|
|
assert set(resource_to_create).issubset(set(created_resource)), created_resource |
|
|
assert set(resource_to_create).issubset(set(created_resource)), created_resource |
|
|
|
|
|
|
|
|
|
|
|
# Test getting resource with wildcard |
|
|
|
|
|
# Without matchingUri query option |
|
|
|
|
|
resource_set_list_ids = uma.resource_set_list_ids(uri="/some_resources/resource") |
|
|
|
|
|
assert len(resource_set_list_ids) == 0 |
|
|
|
|
|
# With matchingUri query option |
|
|
|
|
|
resource_set_list_ids = uma.resource_set_list_ids( |
|
|
|
|
|
uri="/some_resources/resource", matchingUri=True |
|
|
|
|
|
) |
|
|
|
|
|
assert len(resource_set_list_ids) == 1 |
|
|
|
|
|
|
|
|
# Test create the same resource set |
|
|
# Test create the same resource set |
|
|
with pytest.raises(KeycloakPostError) as err: |
|
|
with pytest.raises(KeycloakPostError) as err: |
|
|
uma.resource_set_create(resource_to_create) |
|
|
uma.resource_set_create(resource_to_create) |
|
@ -382,12 +393,23 @@ async def test_a_uma_resource_sets(uma: KeycloakUMA): |
|
|
"name": "mytest", |
|
|
"name": "mytest", |
|
|
"scopes": ["test:read", "test:write"], |
|
|
"scopes": ["test:read", "test:write"], |
|
|
"type": "urn:test", |
|
|
"type": "urn:test", |
|
|
|
|
|
"uris": ["/some_resources/*"], |
|
|
} |
|
|
} |
|
|
created_resource = await uma.a_resource_set_create(resource_to_create) |
|
|
created_resource = await uma.a_resource_set_create(resource_to_create) |
|
|
assert created_resource |
|
|
assert created_resource |
|
|
assert created_resource["_id"], created_resource |
|
|
assert created_resource["_id"], created_resource |
|
|
assert set(resource_to_create).issubset(set(created_resource)), created_resource |
|
|
assert set(resource_to_create).issubset(set(created_resource)), created_resource |
|
|
|
|
|
|
|
|
|
|
|
# Test getting resource with wildcard |
|
|
|
|
|
# Without matchingUri query option |
|
|
|
|
|
resource_set_list_ids = await uma.a_resource_set_list_ids(uri="/some_resources/resource") |
|
|
|
|
|
assert len(resource_set_list_ids) == 0 |
|
|
|
|
|
# With matchingUri query option |
|
|
|
|
|
resource_set_list_ids = await uma.a_resource_set_list_ids( |
|
|
|
|
|
uri="/some_resources/resource", matchingUri=True |
|
|
|
|
|
) |
|
|
|
|
|
assert len(resource_set_list_ids) == 1 |
|
|
|
|
|
|
|
|
# Test create the same resource set |
|
|
# Test create the same resource set |
|
|
with pytest.raises(KeycloakPostError) as err: |
|
|
with pytest.raises(KeycloakPostError) as err: |
|
|
await uma.a_resource_set_create(resource_to_create) |
|
|
await uma.a_resource_set_create(resource_to_create) |
|
|