use of com.google.iam.v1.TestIamPermissionsResponse in project google-cloud-java by GoogleCloudPlatform.
the class ITSubscriptionAdminClientSnippets method replaceSubscriptionPolicyAndTestPermissionsIsSuccessful.
@Test
public void replaceSubscriptionPolicyAndTestPermissionsIsSuccessful() throws Exception {
String topicName = topics[0];
String subscriptionName = subscriptions[0];
createSubscription(topicName, subscriptionName);
Policy policy = subscriptionAdminClientSnippets.replaceSubscriptionPolicy(subscriptionName);
assertNotNull(policy.getBindingsCount());
assertTrue(policy.getBindings(0).getRole().equalsIgnoreCase(Role.viewer().toString()));
assertTrue(policy.getBindings(0).getMembers(0).equalsIgnoreCase(Identity.allAuthenticatedUsers().toString()));
TestIamPermissionsResponse response = subscriptionAdminClientSnippets.testSubscriptionPermissions(subscriptionName);
assertTrue(response.getPermissionsList().contains("pubsub.subscriptions.get"));
}
Aggregations