File: test_config.py

package info (click to toggle)
python-jenkins 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 556 kB
  • sloc: python: 6,099; makefile: 150
file content (25 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from mock import patch

import jenkins
from tests.jobs.base import JenkinsJobsTestBase


class JenkinsGetJobConfigTest(JenkinsJobsTestBase):

    @patch.object(jenkins.Jenkins, 'jenkins_open')
    def test_encodes_job_name(self, jenkins_mock):
        self.j.get_job_config(u'Test Job')

        self.assertEqual(
            jenkins_mock.call_args[0][0].url,
            self.make_url('job/Test%20Job/config.xml'))
        self._check_requests(jenkins_mock.call_args_list)

    @patch.object(jenkins.Jenkins, 'jenkins_open')
    def test_encodes_job_name_in_folder(self, jenkins_mock):
        self.j.get_job_config(u'a folder/Test Job')

        self.assertEqual(
            jenkins_mock.call_args[0][0].url,
            self.make_url('job/a%20folder/job/Test%20Job/config.xml'))
        self._check_requests(jenkins_mock.call_args_list)