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


Python Requester.post_url方法代码示例

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


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

示例1: test_create_view

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_url [as 别名]
    def test_create_view(self, _poll, _base_poll):
        mock_requester = Requester(username="foouser", password="foopassword")
        mock_requester.get_url = mock.MagicMock(return_value="<div/>")
        mock_requester.post_url = mock.MagicMock(return_value="")
        _poll.return_value = {
            "views": [
                {"name": "All", "url": "http://localhost:8080/views/All"},
                {"name": "NewView", "url": "http://localhost:8080/views/NewView"},
            ]
        }
        _base_poll.return_value = _poll.return_value
        J = Jenkins("http://localhost:8080/", username="foouser", password="foopassword", requester=mock_requester)

        new_view = J.views.create("NewView")
        self.assertTrue(isinstance(new_view, View))
        self.assertEquals(new_view.baseurl, "http://localhost:8080/views/NewView")
开发者ID:Jeff-Meadows,项目名称:jenkinsapi,代码行数:18,代码来源:test_views.py

示例2: test_create_view

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_url [as 别名]
    def test_create_view(self, _poll, _base_poll):
        mock_requester = Requester(username='foouser', password='foopassword')
        mock_requester.get_url = mock.MagicMock(return_value='<div/>')
        mock_requester.post_url = mock.MagicMock(return_value='')
        _poll.return_value = {'views': [
                        {'name': 'All',
                         'url': 'http://localhost:8080/views/All'},
                        {'name': 'NewView',
                         'url': 'http://localhost:8080/views/NewView'},
                        ]}
        _base_poll.return_value = _poll.return_value
        J = Jenkins('http://localhost:8080/',
                    username='foouser', password='foopassword',
                    requester=mock_requester)

        new_view = J.views.create('NewView')
        self.assertTrue(isinstance(new_view, View))
        self.assertEquals(new_view.baseurl,
                'http://localhost:8080/views/NewView')
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:21,代码来源:test_views.py

示例3: test_get_url

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_url [as 别名]
 def test_get_url(self, _post):
     _post.return_value = 'SUCCESS'
     req = Requester('foo', 'bar')
     self.assertTrue(req.post_url('http://dummy',
                     params={'param': 'value'},
                     headers=None)=='SUCCESS')
开发者ID:baris,项目名称:jenkinsapi,代码行数:8,代码来源:test_requester.py


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