From 4efa5d200cb991740b70c31ac6c3434f475cfd69 Mon Sep 17 00:00:00 2001 From: Salim Fadhley Date: Sun, 30 Jun 2013 00:39:02 +0100 Subject: [PATCH] move the pinger job config into the config file --- jenkinsapi_tests/systests/job_configs.py | 32 ++++++++++++++ .../systests/test_jenkins_artifacts.py | 43 ++----------------- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/jenkinsapi_tests/systests/job_configs.py b/jenkinsapi_tests/systests/job_configs.py index a7a4204..59c5c47 100644 --- a/jenkinsapi_tests/systests/job_configs.py +++ b/jenkinsapi_tests/systests/job_configs.py @@ -125,3 +125,35 @@ SCM_GIT_JOB = """ """ + +JOB_WITH_ARTIFACTS = """ + + + + Ping a load of stuff for about 10s + false + + + true + false + false + false + + false + + + ping -c 5 localhost | tee out.txt + + + + + *.txt + false + + + + true + + + +""".strip() \ No newline at end of file diff --git a/jenkinsapi_tests/systests/test_jenkins_artifacts.py b/jenkinsapi_tests/systests/test_jenkins_artifacts.py index e1ea886..ee69ae9 100644 --- a/jenkinsapi_tests/systests/test_jenkins_artifacts.py +++ b/jenkinsapi_tests/systests/test_jenkins_artifacts.py @@ -6,46 +6,16 @@ import time import shutil import tempfile import unittest -from jenkinsapi_tests.test_utils.random_strings import random_string -from jenkinsapi_tests.systests.base import BaseSystemTest -PINGER_JOB_CONFIG = """ - - - - Ping a load of stuff for about 10s - false - - - true - false - false - false - - false - - - ping -c 5 localhost | tee out.txt - - - - - *.txt - false - - - - true - - - -""".strip() +from jenkinsapi_tests.systests.base import BaseSystemTest +from jenkinsapi_tests.systests.job_configs import JOB_WITH_ARTIFACTS +from jenkinsapi_tests.test_utils.random_strings import random_string class TestPingerJob(BaseSystemTest): def test_invoke_job(self): job_name = 'create_%s' % random_string() - job = self.jenkins.create_job(job_name, PINGER_JOB_CONFIG) + job = self.jenkins.create_job(job_name, JOB_WITH_ARTIFACTS) job.invoke(block=True) b = job.get_last_build() @@ -61,7 +31,6 @@ class TestPingerJob(BaseSystemTest): tempDir = tempfile.mkdtemp() try: - tf = tempfile.NamedTemporaryFile(mode='wb') artifact.save_to_dir(tempDir) readBackText = open(os.path.join(tempDir, artifact.filename), 'rb').read().strip() self.assertTrue(readBackText.startswith('PING localhost')) @@ -69,9 +38,5 @@ class TestPingerJob(BaseSystemTest): finally: shutil.rmtree(tempDir) - - # TODO: Actually verify the download - - if __name__ == '__main__': unittest.main() -- 2.34.1