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


Python Requester.post_xml_and_confirm_status方法代码示例

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


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

示例1: test_post_xml_and_confirm_status_empty_xml

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_xml_and_confirm_status [as 别名]
    def test_post_xml_and_confirm_status_empty_xml(self, _post):
        _post.return_value = 'SUCCESS'
        req = Requester('foo', 'bar')
        with self.assertRaises(AssertionError) as ae:
            req.post_xml_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:baris,项目名称:jenkinsapi,代码行数:12,代码来源:test_requester.py

示例2: test_get_jenkins_obj_from_url

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_xml_and_confirm_status [as 别名]
    def test_get_jenkins_obj_from_url(self, _base_poll, _poll, _job_poll):
        _job_poll.return_value = {}
        _poll.return_value = {
            'jobs': [
                {'name': 'job_one',
                 'url': 'http://localhost:8080/job_one',
                 'color': 'blue'},
                {'name': 'job_one',
                 'url': 'http://localhost:8080/job_one',
                 'color': 'blue'},
            ]
        }
        _base_poll.return_value = _poll.return_value

        mock_requester = Requester(username='foouser', password='foopassword')
        mock_requester.post_xml_and_confirm_status = mock.MagicMock(
            return_value='')

        J = Jenkins('http://localhost:8080/',
                    username='foouser', password='foopassword',
                    requester=mock_requester)

        new_jenkins = J.get_jenkins_obj_from_url('http://localhost:8080/')
        self.assertEquals(new_jenkins, J)

        new_jenkins = J.get_jenkins_obj_from_url('http://localhost:8080/foo')
        self.assertNotEquals(new_jenkins, J)
开发者ID:AmyLewis,项目名称:jenkinsapi,代码行数:29,代码来源:test_jenkins.py

示例3: test_create_new_job_fail

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_xml_and_confirm_status [as 别名]
    def test_create_new_job_fail(self, _base_poll, _poll, _job_poll):
        _job_poll.return_value = {}
        _poll.return_value = {
            'jobs': [
                {'name': 'job_one',
                 'url': 'http://localhost:8080/job_one',
                 'color': 'blue'},
                {'name': 'job_one',
                 'url': 'http://localhost:8080/job_one',
                 'color': 'blue'},
            ]
        }
        _base_poll.return_value = _poll.return_value

        mock_requester = Requester(username='foouser', password='foopassword')
        mock_requester.post_xml_and_confirm_status = mock.MagicMock(
            return_value='')

        J = Jenkins('http://localhost:8080/',
                    username='foouser', password='foopassword',
                    requester=mock_requester)

        with self.assertRaises(JenkinsAPIException) as ar:
            J.create_job('job_new', None)

        self.assertEquals(str(ar.exception), 'Cannot create job job_new')
开发者ID:AmyLewis,项目名称:jenkinsapi,代码行数:28,代码来源:test_jenkins.py

示例4: test_post_xml_and_confirm_status_some_xml

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

示例5: test_create_new_job

# 需要导入模块: from jenkinsapi.utils.requester import Requester [as 别名]
# 或者: from jenkinsapi.utils.requester.Requester import post_xml_and_confirm_status [as 别名]
    def test_create_new_job(self, _poll, _job_poll):
        _job_poll.return_value = {}

        mock_requester = Requester(username='foouser', password='foopassword')
        mock_requester.post_xml_and_confirm_status = mock.MagicMock(return_value='')

        J = Jenkins('http://localhost:8080/',
                    username='foouser', password='foopassword',
                    requester=mock_requester)

        job = J.create_job('job_new', None)
        self.assertTrue(isinstance(job, Job))
        self.assertTrue(job.baseurl == 'http://localhost:8080/job_new')
        self.assertTrue(job.name == 'job_new')
开发者ID:117111302,项目名称:jenkinsapi,代码行数:16,代码来源:test_jenkins.py


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