Search in sources :

Example 1 with SubjectAccessReviewResponseBuilder

use of io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder 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());
}
Also used : SubjectAccessReviewResponseBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder) SubjectAccessReviewResponse(io.fabric8.openshift.api.model.SubjectAccessReviewResponse) LocalSubjectAccessReviewBuilder(io.fabric8.openshift.api.model.LocalSubjectAccessReviewBuilder) SubjectAccessReviewBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with SubjectAccessReviewResponseBuilder

use of io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder 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());
}
Also used : SubjectAccessReviewResponseBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder) LocalSubjectAccessReviewBuilder(io.fabric8.openshift.api.model.LocalSubjectAccessReviewBuilder) SubjectAccessReviewResponse(io.fabric8.openshift.api.model.SubjectAccessReviewResponse) Test(org.junit.jupiter.api.Test)

Example 3 with SubjectAccessReviewResponseBuilder

use of io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder 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());
}
Also used : SubjectAccessReviewResponseBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder) SubjectAccessReviewResponse(io.fabric8.openshift.api.model.SubjectAccessReviewResponse) LocalSubjectAccessReviewBuilder(io.fabric8.openshift.api.model.LocalSubjectAccessReviewBuilder) SubjectAccessReviewBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewBuilder) Test(org.junit.jupiter.api.Test)

Example 4 with SubjectAccessReviewResponseBuilder

use of io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder 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());
}
Also used : SubjectAccessReviewResponseBuilder(io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder) LocalSubjectAccessReviewBuilder(io.fabric8.openshift.api.model.LocalSubjectAccessReviewBuilder) SubjectAccessReviewResponse(io.fabric8.openshift.api.model.SubjectAccessReviewResponse) Test(org.junit.jupiter.api.Test)

Aggregations

LocalSubjectAccessReviewBuilder (io.fabric8.openshift.api.model.LocalSubjectAccessReviewBuilder)4 SubjectAccessReviewResponse (io.fabric8.openshift.api.model.SubjectAccessReviewResponse)4 SubjectAccessReviewResponseBuilder (io.fabric8.openshift.api.model.SubjectAccessReviewResponseBuilder)4 Test (org.junit.jupiter.api.Test)4 SubjectAccessReviewBuilder (io.fabric8.openshift.api.model.SubjectAccessReviewBuilder)2