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')
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')
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'
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'