Пример #1
0
 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')
Пример #2
0
 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')
Пример #3
0
def test_get_url_post(monkeypatch):
    def fake_post(*args, **kwargs):  # pylint: disable=unused-argument
        return 'SUCCESS'

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

    req = Requester('foo', 'bar')
    response = req.post_url('http://dummy',
                            params={'param': 'value'},
                            headers=None)

    assert response == 'SUCCESS'
Пример #4
0
def test_get_url_post(monkeypatch):
    def fake_post(*args, **kwargs):  # pylint: disable=unused-argument
        return 'SUCCESS'

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

    req = Requester('foo', 'bar')
    response = req.post_url(
        'http://dummy',
        params={'param': 'value'},
        headers=None)

    assert response == 'SUCCESS'