Search in sources :

Example 1 with UpdateAssumeRolePolicyResult

use of com.amazonaws.services.identitymanagement.model.UpdateAssumeRolePolicyResult in project pipeline-aws-plugin by jenkinsci.

the class UpdateTrustPolicyStepTests method updateTrustPolicy.

@Test
public void updateTrustPolicy() throws Exception {
    WorkflowJob job = this.jenkinsRule.jenkins.createProject(WorkflowJob.class, "updateTest");
    Mockito.when(this.iam.updateAssumeRolePolicy(Mockito.any(UpdateAssumeRolePolicyRequest.class))).thenReturn(new UpdateAssumeRolePolicyResult());
    job.setDefinition(new CpsFlowDefinition("" + "node {\n" + "  writeFile(file: 'testfile', text: '{}')\n" + "  updateTrustPolicy(roleName: 'testRole', policyFile: 'testfile')\n" + "}\n", true));
    this.jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));
    Mockito.verify(this.iam).updateAssumeRolePolicy(new UpdateAssumeRolePolicyRequest().withRoleName("testRole").withPolicyDocument("{}"));
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) UpdateAssumeRolePolicyRequest(com.amazonaws.services.identitymanagement.model.UpdateAssumeRolePolicyRequest) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) UpdateAssumeRolePolicyResult(com.amazonaws.services.identitymanagement.model.UpdateAssumeRolePolicyResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

UpdateAssumeRolePolicyRequest (com.amazonaws.services.identitymanagement.model.UpdateAssumeRolePolicyRequest)1 UpdateAssumeRolePolicyResult (com.amazonaws.services.identitymanagement.model.UpdateAssumeRolePolicyResult)1 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)1 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1