Fixes for this bug.
This commit is contained in:
parent
a64d11bd47
commit
08f41aa93f
@ -336,8 +336,9 @@ class Jenkins(object):
|
|||||||
:param name: Name of Jenkins job, ``str``
|
:param name: Name of Jenkins job, ``str``
|
||||||
:returns: job configuration (XML format)
|
:returns: job configuration (XML format)
|
||||||
'''
|
'''
|
||||||
get_config_url = self.server + CONFIG_JOB%locals()
|
request = urllib2.Request(self.server + CONFIG_JOB %
|
||||||
return self.jenkins_open(urllib2.Request(get_config_url))
|
{"name": urllib.quote(name)})
|
||||||
|
return self.jenkins_open(request)
|
||||||
|
|
||||||
def reconfig_job(self, name, config_xml):
|
def reconfig_job(self, name, config_xml):
|
||||||
'''
|
'''
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
5
tests/helper.py
Normal file
5
tests/helper.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
|
import jenkins
|
20
tests/test_jenkins.py
Normal file
20
tests/test_jenkins.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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')
|
Loading…
Reference in New Issue
Block a user