}
@Test
public void shouldCheckReadPermissions() throws Exception {
// pre-conditions
IAuthorization authorization = user.createAuthorization("my note", IAuthorization.SCOPE_READ, 600);
assertNotNull(authorization.getToken());
assertEquals(authorization.getScopes(), IAuthorization.SCOPE_READ);
try {
//read scope should not be allowed to create new authorizations
IOpenShiftConnection connection =
new TestConnectionBuilder().token(authorization.getToken()).disableSSLCertificateChecks().create();
connection.getUser().createAuthorization("shouldn't be allowed", IAuthorization.SCOPE_SESSION, 600);
//should never get here
assertTrue(false);
} catch (OpenShiftEndpointException ex){
assertThat(ex.getMessage(), StringContains.containsString("This action is not allowed with your current authorization"));
}
//clean up
authorization.destroy();
}