Test api v11 response for trigger job

This commit is contained in:
Greg Schueler 2014-11-10 11:14:27 -08:00
parent c8e1315612
commit 8cc48ecd89
3 changed files with 85 additions and 0 deletions

View file

@ -634,6 +634,43 @@ public class RundeckClientTest {
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_job_basic_v11")
public void triggerJobBasic_v11() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
"-3f27cc0ee1a5").build());
Assert.assertEquals((Long) 943L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
/**
* Response for API v11 incorrectly includes <result>, but we should handle this case
* @throws Exception
*/
@Test
@Betamax(tape = "trigger_job_basic_v11_patch")
public void triggerJobBasic_v11_patch() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
"-3f27cc0ee1a5").build());
Assert.assertEquals((Long) 944L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_job_as_user")