本文整理汇总了Python中jenkinsapi.utils.requester.Requester.get_and_confirm_status方法的典型用法代码示例。如果您正苦于以下问题:Python Requester.get_and_confirm_status方法的具体用法?Python Requester.get_and_confirm_status怎么用?Python Requester.get_and_confirm_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkinsapi.utils.requester.Requester
的用法示例。
在下文中一共展示了Requester.get_and_confirm_status方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_and_confirm_status_bad_result
# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import get_and_confirm_status [as 别名]
def test_get_and_confirm_status_bad_result(self, _get):
response = requests.Response()
response.status_code = 500
_get.return_value = response
req = Requester('foo', 'bar')
with self.assertRaises(JenkinsAPIException) as ae:
req.get_and_confirm_status(
url='http://dummy',
params={'param': 'value'})
print ae.exception.message
self.assertTrue(ae.exception.message=="Operation failed. url=None, headers=None, status=500, text=")
示例2: test_get_and_confirm_status
# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import get_and_confirm_status [as 别名]
def test_get_and_confirm_status(self, _get):
response = requests.Response()
response.status_code = 200
_get.return_value = response
req = Requester('foo', 'bar')
ret = req.get_and_confirm_status(
url='http://dummy',
params={'param': 'value'})
self.assertTrue(isinstance(ret, requests.Response))
示例3: test_get_version_nonexistent
# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import get_and_confirm_status [as 别名]
def test_get_version_nonexistent(self, _base_poll, _poll):
class MockResponse(object):
def __init__(self):
self.headers = {}
base_url = 'http://localhost:8080'
mock_requester = Requester(username='foouser', password='foopassword')
mock_requester.get_and_confirm_status = mock.MagicMock(return_value=MockResponse())
J = Jenkins(base_url,
username='foouser', password='foopassword',
requester=mock_requester)
self.assertEquals('0.0', J.version)