本文整理匯總了Python中autojenkins.Jenkins.transfer方法的典型用法代碼示例。如果您正苦於以下問題:Python Jenkins.transfer方法的具體用法?Python Jenkins.transfer怎麽用?Python Jenkins.transfer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類autojenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.transfer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestJenkins
# 需要導入模塊: from autojenkins import Jenkins [as 別名]
# 或者: from autojenkins.Jenkins import transfer [as 別名]
#.........這裏部分代碼省略.........
def checks_get_config_xml(self, response):
self.assertTrue(response.startswith('<?xml'))
self.assertTrue(response.endswith('</project>'))
# TODO: test job creation, and set_config_xml
def test_create(self, requests):
requests.post.return_value = mock_response()
config_xml = path.join(fixture_path, 'create_copy.txt')
self.jenkins.create('job', config_xml, value='2')
CFG = "<value>2</value><disabled>true</disabled>"
requests.post.assert_called_once_with(
'http://jenkins/createItem',
auth=None,
headers={'Content-Type': 'application/xml'},
params={'name': 'job'},
data=CFG,
verify=True)
def test_create_copy(self, requests):
requests.get.return_value = mock_response('create_copy.txt')
requests.post.return_value = mock_response()
self.jenkins.create_copy('job', 'template', value='2')
CFG = "<value>2</value><disabled>false</disabled>"
requests.post.assert_called_once_with(
'http://jenkins/createItem',
auth=None,
headers={'Content-Type': 'application/xml'},
params={'name': 'job'},
data=CFG,
verify=True)
def test_transfer(self, requests):
requests.get.return_value = mock_response('transfer.txt')
requests.post.return_value = mock_response()
self.jenkins.transfer('job', 'http://jenkins2')
CFG = load_fixture('transfer.txt')
requests.post.assert_called_once_with(
'http://jenkins2/createItem',
auth=None,
headers={'Content-Type': 'application/xml'},
params={'name': 'job'},
data=CFG,
verify=True)
@data(
('build', 'job/{0}/build'),
('delete', 'job/{0}/doDelete'),
('enable', 'job/{0}/enable'),
('disable', 'job/{0}/disable'),
)
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)
response = getattr(self.jenkins, method)('name')
self.assertEqual(302, response.status_code)
requests.post.assert_called_once_with(
'http://jenkins/' + url.format('name'),
auth=None,
verify=True)
def test_set_config_xml(self, requests):
requests.post.return_value = Mock(status_code=200)
CFG = '<config>x</config>'