use of com.amazonaws.services.identitymanagement.model.SimulatePrincipalPolicyResult in project cloudbreak by hortonworks.
the class AwsIDBrokerAssumeRoleValidatorTest method checkCanAssumeRoles.
@Test
public void checkCanAssumeRoles() {
Role instanceProfileRole = new Role();
InstanceProfile instanceProfile = new InstanceProfile().withRoles(instanceProfileRole);
Role role = new Role().withArn("roleArn");
Collection<Role> roles = Collections.singletonList(role);
EvaluationResult evalResult = new EvaluationResult().withEvalDecision(PolicyEvaluationDecisionType.Allowed).withEvalResourceName(role.getArn());
when(iam.simulatePrincipalPolicy(any(SimulatePrincipalPolicyRequest.class))).thenReturn(new SimulatePrincipalPolicyResult().withEvaluationResults(evalResult));
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
assertThat(awsIDBrokerAssumeRoleValidator.canAssumeRoles(iam, instanceProfile, roles, validationResultBuilder)).isTrue();
assertThat(validationResultBuilder.build().hasError()).isFalse();
}
Aggregations