Fix listApplicationsThirdParty
This commit is contained in:
parent
eb0124e3e1
commit
490590625d
1 changed files with 20 additions and 3 deletions
|
@ -925,11 +925,22 @@ public class AccountRestServiceTest extends AbstractRestServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void listApplicationsThirdParty() throws Exception {
|
public void listApplicationsThirdPartyWithoutConsentText() throws Exception {
|
||||||
|
listApplicationsThirdParty("acr", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void listApplicationsThirdPartyWithConsentText() throws Exception {
|
||||||
|
listApplicationsThirdParty("profile", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void listApplicationsThirdParty(String clientScopeName, boolean expectConsentTextAsName) throws Exception {
|
||||||
String appId = "third-party";
|
String appId = "third-party";
|
||||||
TokenUtil token = new TokenUtil("view-applications-access", "password");
|
TokenUtil token = new TokenUtil("view-applications-access", "password");
|
||||||
|
|
||||||
ClientScopeRepresentation clientScopeRepresentation = testRealm().clientScopes().findAll().get(0);
|
ClientScopeRepresentation clientScopeRepresentation = testRealm().clientScopes().findAll().stream()
|
||||||
|
.filter(s -> s.getName().equals(clientScopeName))
|
||||||
|
.findFirst().get();
|
||||||
ConsentScopeRepresentation consentScopeRepresentation = new ConsentScopeRepresentation();
|
ConsentScopeRepresentation consentScopeRepresentation = new ConsentScopeRepresentation();
|
||||||
consentScopeRepresentation.setId(clientScopeRepresentation.getId());
|
consentScopeRepresentation.setId(clientScopeRepresentation.getId());
|
||||||
|
|
||||||
|
@ -964,7 +975,13 @@ public class AccountRestServiceTest extends AbstractRestServiceTest {
|
||||||
assertFalse(app.getConsent().getGrantedScopes().isEmpty());
|
assertFalse(app.getConsent().getGrantedScopes().isEmpty());
|
||||||
ConsentScopeRepresentation grantedScope = app.getConsent().getGrantedScopes().get(0);
|
ConsentScopeRepresentation grantedScope = app.getConsent().getGrantedScopes().get(0);
|
||||||
assertEquals(clientScopeRepresentation.getId(), grantedScope.getId());
|
assertEquals(clientScopeRepresentation.getId(), grantedScope.getId());
|
||||||
assertEquals(clientScopeRepresentation.getAttributes().get(ClientScopeModel.CONSENT_SCREEN_TEXT) != null ? clientScopeRepresentation.getAttributes().get(ClientScopeModel.CONSENT_SCREEN_TEXT) : clientScopeRepresentation.getName(), grantedScope.getName());
|
|
||||||
|
if (expectConsentTextAsName) {
|
||||||
|
assertEquals(clientScopeRepresentation.getAttributes().get(ClientScopeModel.CONSENT_SCREEN_TEXT), grantedScope.getName());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assertEquals(clientScopeRepresentation.getName(), grantedScope.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue