From: Sudharshan S Date: Tue, 25 Jun 2013 16:24:31 +0000 (+0530) Subject: Begin test cases for testing jenkins API calls related to the SCM X-Git-Tag: v0.2.23~121^2~8^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a4de01a44f4da8d868b35bf291a613586f95e98;p=tools%2Fpython-jenkinsapi.git Begin test cases for testing jenkins API calls related to the SCM Use JenkinsLauncher.install_plugin to install Jenkins git plugins and verify coverage for Build.get_revision() fix --- diff --git a/jenkinsapi_tests/systests/job_configs.py b/jenkinsapi_tests/systests/job_configs.py index 4cea72b..a7a4204 100644 --- a/jenkinsapi_tests/systests/job_configs.py +++ b/jenkinsapi_tests/systests/job_configs.py @@ -67,3 +67,61 @@ SHORTISH_JOB = """ """.strip() + + +SCM_GIT_JOB = """ + + + + + + + 2 + + + + + https://github.com/salimfadhley/jenkinsapi.git + + + + + ** + + + false + false + false + false + false + false + false + false + false + false + + Default + + + + + + + + false + + + + true + false + false + false + + + ping -c 10 localhost + + + + + +""" diff --git a/jenkinsapi_tests/systests/test_scm.py b/jenkinsapi_tests/systests/test_scm.py new file mode 100644 index 0000000..c5fcfb1 --- /dev/null +++ b/jenkinsapi_tests/systests/test_scm.py @@ -0,0 +1,31 @@ +''' +System tests for `jenkinsapi.jenkins` module. +''' +import unittest +from jenkinsapi.invocation import Invocation +from jenkinsapi_tests.systests import state +from jenkinsapi_tests.systests.base import BaseSystemTest +from jenkinsapi_tests.test_utils.random_strings import random_string +from jenkinsapi_tests.systests.job_configs import SCM_GIT_JOB + +# Maybe have a base class for all SCM test activites? +class TestSCMGIT(BaseSystemTest): + # Maybe it makes sense to move plugin dependencies outside the code. + # Have a config to dependencies mapping from the launcher can use to install plugins. + PLUGIN_DEPENDENCIES = ["http://updates.jenkins-ci.org/latest/git.hpi", + "http://updates.jenkins-ci.org/latest/git-client.hpi"] + + def test_get_revision(self): + job_name = 'create_%s' % random_string() + state['launcher'].install_plugin(self.PLUGIN_DEPENDENCIES) + job = self.jenkins.create_job(job_name, SCM_GIT_JOB) + ii = job.invoke() + ii.block(until='completed') + self.assertFalse(ii.is_running()) + bn = ii.get_build_number() + b = job.get_build(bn) + self.assertIsInstance(b.get_revision(), basestring) + +if __name__ == '__main__': + unittest.main() +