use of io.fabric8.openshift.api.model.SubjectAccessReviewResponse in project kubernetes-client by fabric8io.
the class SubjectAccessReviewTest method testCreate.
@Test
void testCreate() {
server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder().withReason("r1").build()).once();
SubjectAccessReviewResponse response = client.inAnyNamespace().subjectAccessReviews().create(new SubjectAccessReviewBuilder().build());
assertNotNull(response);
assertEquals("r1", response.getReason());
}
use of io.fabric8.openshift.api.model.SubjectAccessReviewResponse in project kubernetes-client by fabric8io.
the class SubjectAccessReviewTest method testCreateLocal.
@Test
void testCreateLocal() {
server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder().withReason("r1").build()).once();
SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test").create(new LocalSubjectAccessReviewBuilder().withNamespace("test").withVerb("get").withGroups("test.fabric8.io").build());
assertNotNull(response);
assertEquals("r1", response.getReason());
}
use of io.fabric8.openshift.api.model.SubjectAccessReviewResponse in project kubernetes-client by fabric8io.
the class SubjectAccessReviewTest method testCreateInLine.
@Test
void testCreateInLine() {
server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder().withReason("r2").build()).once();
SubjectAccessReviewResponse response = client.inAnyNamespace().subjectAccessReviews().create(new SubjectAccessReviewBuilder().build());
assertNotNull(response);
assertEquals("r2", response.getReason());
}
use of io.fabric8.openshift.api.model.SubjectAccessReviewResponse in project kubernetes-client by fabric8io.
the class SubjectAccessReviewTest method testCreateLocalInLine.
@Test
void testCreateLocalInLine() {
server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder().withReason("r2").build()).once();
SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test").create(new LocalSubjectAccessReviewBuilder().withUser("user").withVerb("verb").build());
assertNotNull(response);
assertEquals("r2", response.getReason());
}
use of io.fabric8.openshift.api.model.SubjectAccessReviewResponse in project kubernetes-client by fabric8io.
the class OpenShiftAuthorizationIT method createLocalSubjectAccessReview.
@Test
public void createLocalSubjectAccessReview() {
// Given
LocalSubjectAccessReview localSubjectAccessReview = new LocalSubjectAccessReviewBuilder().withNamespace(session.getNamespace()).withVerb("get").withResource("pods").build();
// When
SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace(session.getNamespace()).create(localSubjectAccessReview);
// Then
assertNotNull(response);
assertTrue(response.getAllowed());
}
Aggregations