From 1fc2785f45229baecbbe9da4246e2ce305e30408 Mon Sep 17 00:00:00 2001 From: salimfadhley Date: Tue, 2 Jul 2013 00:53:32 +0100 Subject: [PATCH] Add an extra test to verify multiple invocation behavior. --- jenkinsapi_tests/systests/test_invocation.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/jenkinsapi_tests/systests/test_invocation.py b/jenkinsapi_tests/systests/test_invocation.py index b68d598..f438353 100644 --- a/jenkinsapi_tests/systests/test_invocation.py +++ b/jenkinsapi_tests/systests/test_invocation.py @@ -6,7 +6,7 @@ from jenkinsapi.build import Build from jenkinsapi.invocation import Invocation from jenkinsapi_tests.systests.base import BaseSystemTest from jenkinsapi_tests.test_utils.random_strings import random_string -from jenkinsapi_tests.systests.job_configs import LONG_RUNNING_JOB, SHORTISH_JOB +from jenkinsapi_tests.systests.job_configs import LONG_RUNNING_JOB, SHORTISH_JOB, EMPTY_JOB class TestInvocation(BaseSystemTest): @@ -39,5 +39,22 @@ class TestInvocation(BaseSystemTest): ii.block(until='completed') self.assertFalse(ii.is_running()) + def test_multiple_invocations_and_get_last_build(self): + job_name = 'create_%s' % random_string() + + job = self.jenkins.create_job(job_name, EMPTY_JOB) + + for _ in range(3): + ii = job.invoke() + ii.block(until='completed') + + build_number = job.get_last_buildnumber() + self.assertEquals(build_number, 3) + + build = job.get_build(build_number) + self.assertIsInstance(build, Build) + + + if __name__ == '__main__': unittest.main() -- 2.7.4