def test_content_type(): responses.add(responses.GET, 'http://mock/test', body='{"test": True}', status=502, content_type=None) r = requests.get('http://mock/test') data = Interface(None).get_data(r) assert data is None
def test_client_error(): responses.add(responses.GET, 'http://mock/test', body='{"test": True}', status=404, content_type=None) r = requests.get('http://mock/test') with pytest.raises(exceptions.ClientError): Interface(None).get_data(r, exceptions=True)
def test_client_error(): with HTTMock(client_error): response = requests.get('http://mock/test') with pytest.raises(exceptions.ClientError): Interface(None).get_data(response, exceptions=True)
def test_missing_content_type(): with HTTMock(server_error): response = requests.get('http://mock/test') data = Interface(None).get_data(response) assert data is None