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


Python jenkins.Requester类代码示例

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


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

示例1: test_get_url_get

 def test_get_url_get(self, _get):
     _get.return_value = 'SUCCESS'
     req = Requester('foo', 'bar')
     response = req.get_url(
         'http://dummy',
         params={'param': 'value'},
         headers=None)
     self.assertEqual(response, 'SUCCESS')
开发者ID:hughdbrown,项目名称:jenkinsapi,代码行数:8,代码来源:test_requester.py

示例2: test_get_url_post

 def test_get_url_post(self, _post):
     _post.return_value = 'SUCCESS'
     req = Requester('foo', 'bar')
     response = req.post_url(
         'http://dummy',
         params={'param': 'value'},
         headers=None)
     self.assertTrue(response == 'SUCCESS')
开发者ID:naphthalene,项目名称:jenkinsapi,代码行数:8,代码来源:test_requester.py

示例3: test_get_request_dict_wrong_headers

    def test_get_request_dict_wrong_headers(self):
        req = Requester('foo', 'bar')

        with self.assertRaises(AssertionError) as na:
            req_return = req.get_request_dict(url='http://', params={}, 
                data=None, headers='wrong')
        self.assertTrue(
                na.exception.message=="headers must be a dict, got 'wrong'")
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:8,代码来源:test_requester.py

示例4: test_get_request_dict_auth

    def test_get_request_dict_auth(self):
        req = Requester('foo', 'bar')

        req_return = req.get_request_dict(url='http://', params={}, data=None,
                headers=None)
        self.assertTrue(isinstance(req_return, dict))
        self.assertTrue(req_return.get('auth'))
        self.assertTrue(req_return['auth']==('foo', 'bar'))
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:8,代码来源:test_requester.py

示例5: test_get_request_dict_data_not_passed

    def test_get_request_dict_data_not_passed(self):
        req = Requester('foo', 'bar')

        req_return = req.get_request_dict(url='http://', 
            params={'param': 'value'},
            data=None, headers={'header': 'value'})

        self.assertTrue(isinstance(req_return, dict))
        self.assertFalse(req_return.get('data'))
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:9,代码来源:test_requester.py

示例6: test_get_and_confirm_status

 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))
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:9,代码来源:test_requester.py

示例7: test_post_xml_and_confirm_status_empty_xml

 def test_post_xml_and_confirm_status_empty_xml(self, _post):
     _post.return_value = mock.Mock()
     req = Requester('foo', 'bar')
     with self.assertRaises(AssertionError) as ae:
         req.post_xml_and_confirm_status(
             url='http://dummy',
             params={'param': 'value'},
             data=None
         )
开发者ID:AmyLewis,项目名称:jenkinsapi,代码行数:9,代码来源:test_requester.py

示例8: test_get_request_dict_wrong_headers

def test_get_request_dict_wrong_headers():
    req = Requester('foo', 'bar')

    with pytest.raises(AssertionError) as na:
        req.get_request_dict(
            params={},
            data=None,
            headers='wrong'
        )
    assert "headers must be a dict, got 'wrong'" in str(na.value)
开发者ID:PaleoWoods,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例9: test_post_xml_and_confirm_status_empty_xml

    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:aamerine,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例10: test_post_and_confirm_status_empty_data

    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 data type: None')
开发者ID:dvrslype,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例11: test_get_request_dict_wrong_params

    def test_get_request_dict_wrong_params(self):
        req = Requester('foo', 'bar')

        with self.assertRaises(AssertionError) as na:
            req.get_request_dict(
                params='wrong',
                data=None,
                headers=None
            )
        self.assertTrue(na.exception.message == "Params must be a dict, got 'wrong'")
开发者ID:AMAKO11,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例12: test_get_request_dict_correct_headers

    def test_get_request_dict_correct_headers(self):
        req = Requester('foo', 'bar')

        req_return = req.get_request_dict(url='http://', 
            params={'param': 'value'},
            data=None, headers={'header': 'value'})

        self.assertTrue(isinstance(req_return, dict))
        self.assertTrue(req_return.get('headers'))
        self.assertTrue(req_return['headers']=={'header': 'value'})
开发者ID:aamerine,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例13: test_get_request_dict_wrong_headers

    def test_get_request_dict_wrong_headers(self):
        req = Requester('foo', 'bar')

        with self.assertRaises(AssertionError) as na:
            req.get_request_dict(
                params={},
                data=None,
                headers='wrong'
            )
        self.assertTrue(str(na.exception) == "headers must be a dict, got 'wrong'")
开发者ID:naphthalene,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py

示例14: test_post_and_confirm_status_some_data

 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,代码行数:10,代码来源:test_requester.py

示例15: test_get_request_dict_nocookie

def test_get_request_dict_nocookie():
    req = Requester('foo', 'bar')

    req_return = req.get_request_dict(
        params={},
        data=None,
        headers=None
    )
    assert isinstance(req_return, dict)
    assert not req_return.get('headers')
开发者ID:lechat,项目名称:jenkinsapi,代码行数:10,代码来源:test_requester.py


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