use of com.google.iam.v1.TestIamPermissionsRequest in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method testIamPermissionsTest.
@Test
@SuppressWarnings("all")
public void testIamPermissionsTest() {
TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build();
mockIAMPolicy.addResponse(expectedResponse);
String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse actualResponse = client.testIamPermissions(formattedResource, permissions);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockIAMPolicy.getRequests();
Assert.assertEquals(1, actualRequests.size());
TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0);
Assert.assertEquals(formattedResource, actualRequest.getResource());
Assert.assertEquals(permissions, actualRequest.getPermissionsList());
}
use of com.google.iam.v1.TestIamPermissionsRequest in project google-cloud-java by GoogleCloudPlatform.
the class TopicAdminClientTest method testIamPermissionsTest.
@Test
@SuppressWarnings("all")
public void testIamPermissionsTest() {
TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build();
mockIAMPolicy.addResponse(expectedResponse);
String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse actualResponse = client.testIamPermissions(formattedResource, permissions);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockIAMPolicy.getRequests();
Assert.assertEquals(1, actualRequests.size());
TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0);
Assert.assertEquals(formattedResource, actualRequest.getResource());
Assert.assertEquals(permissions, actualRequest.getPermissionsList());
}
Aggregations