当前位置: 首页>>代码示例>>Python>>正文


Python Requester.post_and_confirm_status方法代码示例

本文整理汇总了Python中jenkinsapi.jenkins.Requester.post_and_confirm_status方法的典型用法代码示例。如果您正苦于以下问题:Python Requester.post_and_confirm_status方法的具体用法?Python Requester.post_and_confirm_status怎么用?Python Requester.post_and_confirm_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jenkinsapi.jenkins.Requester的用法示例。


在下文中一共展示了Requester.post_and_confirm_status方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_post_and_confirm_status_empty_data

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
    def test_post_and_confirm_status_empty_data(self, _post):
        _post.return_value = 'SUCCESS'
        req = Requester('foo', 'bar')
        with self.assertRaises(AssertionError) as ae:
            req.post_and_confirm_status(
                            url='http://dummy',
                            params={'param': 'value'},
                            data=None)

        self.assertTrue(ae.exception.message=="Unexpected type of parameter 'data': <type 'NoneType'>. Expected (str, dict)")
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:12,代码来源:test_requester.py

示例2: test_post_and_confirm_status_empty_data

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
 def test_post_and_confirm_status_empty_data(self, _post):
     mock_response = mock.Mock()
     _post.return_value = mock_response
     req = Requester('foo', 'bar')
     with self.assertRaises(AssertionError) as ae:
         req.post_and_confirm_status(
             url='http://dummy',
             params={'param': 'value'},
             data=None
         )
开发者ID:AmyLewis,项目名称:jenkinsapi,代码行数:12,代码来源:test_requester.py

示例3: test_post_and_confirm_status_empty_data

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
def test_post_and_confirm_status_empty_data(monkeypatch):
    def fake_post(*args, **kwargs):  # pylint: disable=unused-argument
        return 'SUCCESS'

    monkeypatch.setattr(requests, 'post', fake_post)

    req = Requester('foo', 'bar')
    with pytest.raises(AssertionError):
        req.post_and_confirm_status(
            url='http://dummy',
            params={'param': 'value'},
            data=None
        )
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:15,代码来源:test_requester.py

示例4: test_post_and_confirm_status_bad_result

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
    def test_post_and_confirm_status_bad_result(self, _post):
        response = requests.Response()
        response.status_code = 500
        _post.return_value = response

        req = Requester('foo', 'bar')
        with self.assertRaises(JenkinsAPIException) as ae:
            req.post_and_confirm_status(
                            url='http://dummy',
                            params={'param': 'value'},
                            data='some data')

        print ae.exception.message
        self.assertTrue(ae.exception.message=="Operation failed. url=None, data=some data, headers={'Content-Type': 'application/x-www-form-urlencoded'}, status=500, text=")
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:16,代码来源:test_requester.py

示例5: test_post_and_confirm_status_bad_result

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
    def test_post_and_confirm_status_bad_result(self, _post):
        response = requests.Response()
        response.status_code = 500
        _post.return_value = response

        req = Requester('foo', 'bar')
        with self.assertRaises(JenkinsAPIException) as ae:
            req.post_and_confirm_status(
                url='http://dummy',
                params={'param': 'value'},
                data='some data'
            )

        self.assertIsInstance(ae.exception, JenkinsAPIException)
开发者ID:117111302,项目名称:jenkinsapi,代码行数:16,代码来源:test_requester.py

示例6: test_post_and_confirm_status_some_data

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
 def test_post_and_confirm_status_some_data(self, _post):
     response = requests.Response()
     response.status_code = 200
     _post.return_value = response
     req = Requester('foo', 'bar')
     ret = req.post_and_confirm_status(
                     url='http://dummy',
                     params={'param': 'value'},
                     data='some data')
     self.assertTrue(isinstance(ret, requests.Response))
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:12,代码来源:test_requester.py

示例7: test_post_and_confirm_status_bad_result

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
def test_post_and_confirm_status_bad_result(monkeypatch):
    class FakeResponse(object):
        def __init__(self, *args, **kwargs):  # pylint: disable=unused-argument
            self.status_code = 500
            self.url = 'http://dummy'
            self.text = 'something'

    def fake_post(*args, **kwargs):  # pylint: disable=unused-argument
        return FakeResponse()

    monkeypatch.setattr(requests, 'post', fake_post)

    req = Requester('foo', 'bar')
    with pytest.raises(JenkinsAPIException):
        req.post_and_confirm_status(
            url='http://dummy',
            params={'param': 'value'},
            data='some data'
        )
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:21,代码来源:test_requester.py

示例8: test_post_and_confirm_status_some_data

# 需要导入模块: from jenkinsapi.jenkins import Requester [as 别名]
# 或者: from jenkinsapi.jenkins.Requester import post_and_confirm_status [as 别名]
def test_post_and_confirm_status_some_data(monkeypatch):
    class FakeResponse(requests.Response):
        def __init__(self, *args, **kwargs):  # pylint: disable=unused-argument
            self.status_code = 200

    def fake_post(*args, **kwargs):  # pylint: disable=unused-argument
        return FakeResponse()

    monkeypatch.setattr(requests, 'post', fake_post)

    req = Requester('foo', 'bar')
    ret = req.post_and_confirm_status(
        url='http://dummy',
        params={'param': 'value'},
        data='some data'
    )
    assert isinstance(ret, requests.Response)
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:19,代码来源:test_requester.py


注:本文中的jenkinsapi.jenkins.Requester.post_and_confirm_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。