public async Task WhenUserInRole_ThenIsGrantedPermissionReturnsTrue( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { var adapter = new ResourceManagerAdapter(await credential); var result = await adapter.IsGrantedPermission( TestProject.ProjectId, Permissions.ComputeInstancesGet); Assert.IsTrue(result); }
public async Task WhenUserNotInRole_ThenIsGrantedPermissionReturnsFalse( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { var adapter = new ResourceManagerAdapter(await credential); var result = await adapter.IsGrantedPermission( TestProject.ProjectId, "compute.disks.create"); Assert.IsFalse(result); }
public async Task WhenUserInRole_ThenIsGrantedPermissionReturnsTrue( [Credential(Role = PredefinedRole.ComputeViewer)] CredentialRequest credential) { var adapter = new ResourceManagerAdapter(await credential.GetCredentialAsync()); var result = await adapter.IsGrantedPermission( TestProject.ProjectId, "compute.instances.get"); Assert.IsTrue(result); }
public async Task WhenUserNotInRole_ThenIsGrantedPermissionReturnsFalse( [LinuxInstance] InstanceRequest testInstance, [Credential(Role = PredefinedRole.ComputeViewer)] CredentialRequest credential) { await testInstance.AwaitReady(); var instanceRef = await testInstance.GetInstanceAsync(); var adapter = new ResourceManagerAdapter(await credential.GetCredentialAsync()); var result = await adapter.IsGrantedPermission( TestProject.ProjectId, "iam.serviceAccounts.actAs"); Assert.IsFalse(result); }