more invocation stuff, temporary commit as I move to a new computer
authorSalim Fadhley <sal@stodge.org>
Sun, 23 Jun 2013 20:21:01 +0000 (21:21 +0100)
committerSalim Fadhley <sal@stodge.org>
Sun, 23 Jun 2013 20:21:01 +0000 (21:21 +0100)
README.rst
jenkinsapi/invocation.py
jenkinsapi_tests/systests/base.py
jenkinsapi_tests/systests/job_configs.py
jenkinsapi_tests/systests/test_invocation.py

index a635a7e..59c396e 100644 (file)
@@ -36,7 +36,7 @@ First of all, thanks for using this project. The fact that you are checking this
 
 Known bugs
 ----------
- [ ] Currently incompatible with Jenkins > 1.518. Job deletion operations fail unless Cross-Site scripting protection is disabled.
+ [x] Currently incompatible with Jenkins > 1.518. Job deletion operations fail unless Cross-Site scripting protection is disabled.
 
  For other issues, please refer to the support URL below.
 
index 6be65c7..d321aba 100644 (file)
@@ -10,18 +10,33 @@ class Invocation(object):
 
     def __init__(self, job):
         self.job = job
+        self.initial_builds = None
 
 
     def __enter__(self):
         """
         Start watching the job
         """
+        self.job.poll()
+        self.initial_builds = set(self.job.get_build_dict().keys())
 
     def __exit__(self, type, value, traceback):
         """
         Finish watching the job - it will track which new queue items or builds have
         been created as a consequence of invoking the job.
         """
+        self.job.poll()
+        newly_created_builds = set(self.job.get_build_dict().keys())
+
+        import ipdb
+        ipdb.set_trace() 
+
+
+    def get_build_number(self):
+        """
+        If this job is building or complete then provide it's build-number
+        """
+        return 1
 
     def block(self, until='completed'):
         """
@@ -38,11 +53,13 @@ class Invocation(object):
         """
         Returns True if this item is on the queue
         """
+        return True
 
     def is_running(self):
         """
         Returns True if this item is executing now
         """
+        return True
 
     def is_queued_or_running(self):
         return self.is_queued() or self.is_running()
index 42edbd3..bae36d2 100644 (file)
@@ -1,5 +1,5 @@
 import unittest
-from jenkinsapi.jenkinsapi_tests.systests.job_configs import EMPTY_JOB
+from jenkinsapi_tests.systests.job_configs import EMPTY_JOB
 from jenkinsapi.jenkins import Jenkins
 
 
index 9008cb9..7b6a4fb 100644 (file)
@@ -1,3 +1,7 @@
+"""
+A selection of job objects used in testing.
+"""
+
 EMPTY_JOB = '''\
 <?xml version='1.0' encoding='UTF-8'?>
 <project>
index f79b9f6..21720a5 100644 (file)
@@ -3,19 +3,25 @@ System tests for `jenkinsapi.jenkins` module.
 '''
 import unittest
 from jenkinsapi.invocation import Invocation
+from jenkinsapi_tests.systests.job_configs import LONG_RUNNING_JOB
 from jenkinsapi_tests.test_utils.random_strings import random_string
-from jenkinsapi_tests.systests.base import BaseSystemTest, EMPTY_JOB_CONFIG
+from jenkinsapi_tests.systests.base import BaseSystemTest
 
 
 class TestInvocation(BaseSystemTest):
 
     def test_invocation_object(self):
         job_name = 'create_%s' % random_string()
-        job = self.jenkins.create_job(job_name, EMPTY_JOB_CONFIG)
+        job = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
         ii = job.invoke()
         self.assertIsInstance(ii, Invocation)
+        self.assertTrue(ii.is_queued_or_running())
+        self.assertEquals(ii.get_build_number(), 1)
 
 
+    def test_multiple_inocations(self):
+       pass
+        
 
 
 if __name__ == '__main__':