Search in sources :

Example 1 with Resource

use of org.keycloak.testsuite.console.page.clients.authorization.resource.Resource in project keycloak by keycloak.

the class ResourceManagementTest method testUpdate.

@Test
public void testUpdate() {
    ResourceRepresentation expected = createResource();
    String previousName = expected.getName();
    expected.setName("changed");
    expected.setDisplayName("changed");
    expected.setType("changed");
    expected.setUri("changed");
    expected.setScopes(Arrays.asList("Scope A", "Scope B", "Scope C").stream().map(name -> new ScopeRepresentation(name)).collect(Collectors.toSet()));
    authorizationPage.navigateTo();
    Resource resource = authorizationPage.authorizationTabs().resources().name(previousName);
    resource.update(expected);
    assertAlertSuccess();
    assertResource(expected);
    expected.setScopes(expected.getScopes().stream().filter(scope -> scope.getName().equals("Scope C")).collect(Collectors.toSet()));
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().resources().update(expected.getName(), expected);
    assertAlertSuccess();
    assertResource(expected);
}
Also used : Resource(org.keycloak.testsuite.console.page.clients.authorization.resource.Resource) ScopeRepresentation(org.keycloak.representations.idm.authorization.ScopeRepresentation) ResourceRepresentation(org.keycloak.representations.idm.authorization.ResourceRepresentation) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ResourceRepresentation (org.keycloak.representations.idm.authorization.ResourceRepresentation)1 ScopeRepresentation (org.keycloak.representations.idm.authorization.ScopeRepresentation)1 Resource (org.keycloak.testsuite.console.page.clients.authorization.resource.Resource)1