python-jenkins/tests/jobs/test_debug.py
Darragh Bailey c58ae7e1af Separate tests in separate files and classes
Split existing tests into separate files and classes to make it easier
to select a subset to be executed when making modifications.

Add some simple consolidations of test data as example improvements that
can be extended by consolidating complete tests or sets of tests.

Change-Id: If2380e6f4e848ba68f05868e2ef4186d7912952b
2015-08-25 01:11:47 +01:00

26 lines
737 B
Python

import json
from mock import patch
import jenkins
from tests.jobs.base import JenkinsJobsTestBase
class JenkinsDebugJobInfoTest(JenkinsJobsTestBase):
@patch.object(jenkins.Jenkins, 'jenkins_open')
def test_debug_job_info(self, jenkins_mock):
job_info_to_return = {
u'building': False,
u'msg': u'test',
u'revision': 66,
u'user': u'unknown'
}
jenkins_mock.return_value = json.dumps(job_info_to_return)
self.j.debug_job_info(u'Test Job')
self.assertEqual(
jenkins_mock.call_args[0][0].get_full_url(),
u'http://example.com/job/Test%20Job/api/json?depth=0')
self._check_requests(jenkins_mock.call_args_list)