KEYCLOAK-3707 Test retrieving missing client with registration access token
This commit is contained in:
parent
d941e07169
commit
3250562d28
1 changed files with 26 additions and 0 deletions
|
@ -49,6 +49,14 @@ public class RegistrationAccessTokenTest extends AbstractClientRegistrationTest
|
|||
|
||||
client = createClient(c);
|
||||
|
||||
c = new ClientRepresentation();
|
||||
c.setEnabled(true);
|
||||
c.setClientId("SomeOtherClient");
|
||||
c.setSecret("RegistrationAccessTokenTestClientSecret");
|
||||
c.setRootUrl("http://root");
|
||||
|
||||
createClient(c);
|
||||
|
||||
reg.auth(Auth.token(client.getRegistrationAccessToken()));
|
||||
}
|
||||
|
||||
|
@ -81,6 +89,24 @@ public class RegistrationAccessTokenTest extends AbstractClientRegistrationTest
|
|||
assertRead(client.getClientId(), rep.getRegistrationAccessToken(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getClientWrongClient() throws ClientRegistrationException {
|
||||
try {
|
||||
reg.get("SomeOtherClient");
|
||||
} catch (ClientRegistrationException e) {
|
||||
assertEquals(401, ((HttpErrorException) e.getCause()).getStatusLine().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getClientMissingClient() throws ClientRegistrationException {
|
||||
try {
|
||||
reg.get("nosuch");
|
||||
} catch (ClientRegistrationException e) {
|
||||
assertEquals(401, ((HttpErrorException) e.getCause()).getStatusLine().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getClientWithBadRegistrationToken() throws ClientRegistrationException {
|
||||
reg.auth(Auth.token("invalid"));
|
||||
|
|
Loading…
Reference in a new issue