python-jenkins/tests/test_jenkins.py
2012-05-17 16:10:00 +01:00

21 lines
593 B
Python

import unittest
import urllib2
from mock import patch, call
from helper import jenkins
class JenkinsTest(unittest.TestCase):
@patch.object(jenkins.Jenkins, 'jenkins_open')
def test_get_job_config_encodes_job_name(self, jenkins_mock):
"""
The job name parameter specified should be urlencoded properly.
"""
j = jenkins.Jenkins('http://example.com/', 'test', 'test')
j.get_job_config(u'Test Job')
self.assertEqual(jenkins_mock.call_args[0][0].get_full_url(),
u'http://example.com/job/Test%20Job/config.xml')