use of org.keycloak.representations.idm.authorization.ScopeRepresentation in project keycloak by keycloak.
the class ScopeManagementTest method testNotUpdateOnResourceUpdate.
@Test
public void testNotUpdateOnResourceUpdate() {
ResourceScopeResource scopeResource = createDefaultScope();
ScopeRepresentation scope = scopeResource.toRepresentation();
scope.setName("changed");
scope.setDisplayName("changed");
scope.setIconUri("changed");
scopeResource.update(scope);
scope = scopeResource.toRepresentation();
assertEquals("changed", scope.getName());
assertEquals("changed", scope.getDisplayName());
assertEquals("changed", scope.getIconUri());
ResourcesResource resources = getClientResource().authorization().resources();
ResourceRepresentation resource;
try (Response response = resources.create(new ResourceRepresentation(UUID.randomUUID().toString(), scope.getName()))) {
resource = response.readEntity(ResourceRepresentation.class);
}
resource.getScopes().iterator().next().setDisplayName(null);
resources.resource(resource.getId()).update(resource);
scope = scopeResource.toRepresentation();
assertEquals("changed", scope.getName());
assertEquals("changed", scope.getDisplayName());
assertEquals("changed", scope.getIconUri());
}
use of org.keycloak.representations.idm.authorization.ScopeRepresentation in project keycloak by keycloak.
the class ScopeManagementTest method testDeleteFromList.
@Test
public void testDeleteFromList() {
ScopeRepresentation expected = createScope();
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().scopes().deleteFromList(expected.getName());
authorizationPage.navigateTo();
assertNull(authorizationPage.authorizationTabs().scopes().scopes().findByName(expected.getName()));
}
use of org.keycloak.representations.idm.authorization.ScopeRepresentation in project keycloak by keycloak.
the class ScopeManagementTest method assertScope.
private void assertScope(ScopeRepresentation expected) {
authorizationPage.navigateTo();
ScopeRepresentation actual = authorizationPage.authorizationTabs().scopes().scopes().findByName(expected.getName());
assertEquals(expected.getName(), actual.getName());
assertEquals(expected.getIconUri(), actual.getIconUri());
ScopeRepresentation scope = authorizationPage.authorizationTabs().scopes().name(expected.getName()).toRepresentation();
assertEquals(expected.getDisplayName(), scope.getDisplayName());
}
use of org.keycloak.representations.idm.authorization.ScopeRepresentation in project keycloak by keycloak.
the class ScopeManagementTest method testUpdate.
@Test
public void testUpdate() {
ScopeRepresentation expected = createScope();
String previousName = expected.getName();
expected.setName("changed");
expected.setDisplayName("changed");
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().scopes().update(previousName, expected);
assertAlertSuccess();
assertScope(expected);
}
use of org.keycloak.representations.idm.authorization.ScopeRepresentation in project keycloak by keycloak.
the class ScopeManagementTest method testDelete.
@Test
public void testDelete() {
ScopeRepresentation expected = createScope();
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().scopes().delete(expected.getName());
authorizationPage.navigateTo();
assertNull(authorizationPage.authorizationTabs().scopes().scopes().findByName(expected.getName()));
}
Aggregations