small re-organization, now we have a config file for all the jobs used in systests
authorsalimfadhley <sal@stodge.org>
Sun, 23 Jun 2013 07:57:54 +0000 (08:57 +0100)
committerSalim Fadhley <sal@stodge.org>
Sun, 23 Jun 2013 20:21:53 +0000 (21:21 +0100)
jenkinsapi_tests/systests/test_queue.py

index 0e8080e..8bf0e7f 100644 (file)
@@ -5,36 +5,12 @@ import time
 import logging
 import unittest
 from jenkinsapi.queue import Queue
-from jenkinsapi.exceptions import NoBuildData
 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
 
 log = logging.getLogger(__name__)
 
-JOB_XML = """
-<?xml version='1.0' encoding='UTF-8'?>
-<project>
-  <actions/>
-  <description></description>
-  <keepDependencies>false</keepDependencies>
-  <properties/>
-  <scm class="hudson.scm.NullSCM"/>
-  <canRoam>true</canRoam>
-  <disabled>false</disabled>
-  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
-  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
-  <triggers class="vector"/>
-  <concurrentBuild>false</concurrentBuild>
-  <builders>
-    <hudson.tasks.Shell>
-      <command>ping -c 200 localhost</command>
-    </hudson.tasks.Shell>
-  </builders>
-  <publishers/>
-  <buildWrappers/>
-</project>""".strip()
-
-
 class TestQueue(BaseSystemTest):
     """
     All kinds of testing on Jenkins Queues
@@ -49,7 +25,7 @@ class TestQueue(BaseSystemTest):
         jobs = []
 
         for job_name in job_names:
-            j = self.jenkins.create_job(job_name, JOB_XML)
+            j = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
             jobs.append(j)
             j.invoke()
 
@@ -61,7 +37,7 @@ class TestQueue(BaseSystemTest):
 
     def test_start_and_stop_long_running_job(self):
         job_name = random_string()
-        j = self.jenkins.create_job(job_name, JOB_XML)
+        j = self.jenkins.create_job(job_name, LONG_RUNNING_JOB)
         j.invoke()
         self.assertTrue(j.is_queued_or_running())