Permalink
Browse files

Test set_config_xml

  • Loading branch information...
1 parent 5683f55 commit eaf45c6a8177712d4e734f8d622c80b2c8187b19 Carles Barrobés committed Jul 12, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 autojenkins/tests/test_unit_jobs.py
View
14 autojenkins/tests/test_unit_jobs.py
@@ -174,7 +174,7 @@ def test_transfer(self, requests):
('enable', 'job/{0}/enable'),
('disable', 'job/{0}/disable'),
)
- def test_post_methods_with_jobname(self, case, requests):
+ def test_post_methods_with_jobname_no_data(self, case, requests):
method, url = case
# Jenkins API post methods return status 302 upon success
requests.post.return_value = mock_response(status=302)
@@ -184,6 +184,18 @@ def test_post_methods_with_jobname(self, case, requests):
'http://jenkins/' + url.format('name'),
auth=None)
+ def test_set_config_xml(self, requests):
+ requests.post.return_value = Mock()
+ CFG = '<config>x</config>'
+ response = self.jenkins.set_config_xml('name', CFG)
+ # return value is a pass-trough
+ self.assertEqual(requests.post.return_value, response)
+ requests.post.assert_called_once_with(
+ 'http://jenkins/job/name/config.xml',
+ headers={'Content-Type': 'application/xml'},
+ data=CFG,
+ auth=None)
+
@patch('autojenkins.jobs.time')
@patch('autojenkins.jobs.Jenkins.last_result')
@patch('autojenkins.jobs.Jenkins.wait_for_build')

0 comments on commit eaf45c6

Please sign in to comment.