def test_get_url(self, _get): _get.return_value = 'SUCCESS' req = Requester('foo', 'bar') self.assertTrue( req.get_url('http://dummy', params={'param': 'value'}, headers=None) == 'SUCCESS')
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.assertTrue(response == 'SUCCESS')
def test_get_url_get(monkeypatch): def fake_get(*args, **kwargs): # pylint: disable=unused-argument return 'SUCCESS' monkeypatch.setattr(requests, 'get', fake_get) req = Requester('foo', 'bar') response = req.get_url('http://dummy', params={'param': 'value'}, headers=None) assert response == 'SUCCESS'
def test_get_url_get(monkeypatch): def fake_get(*args, **kwargs): # pylint: disable=unused-argument return 'SUCCESS' monkeypatch.setattr(requests, 'get', fake_get) req = Requester('foo', 'bar') response = req.get_url( 'http://dummy', params={'param': 'value'}, headers=None) assert response == 'SUCCESS'