def test_instantiation(self, valid_api_key): with pytest.raises(TypeError): SendGridClientWrapper() with pytest.raises(SendGridClientError): wrapper = SendGridClientWrapper('wrong-key') status, data = wrapper.get(endpoint=VALID_ENDPOINT) response_json = json.loads(data) assert status == 401 assert 'errors' in response_json wrapper = SendGridClientWrapper(valid_api_key) status, data = wrapper.get(endpoint=VALID_ENDPOINT) assert status == 200
def test_call_unknown_request(self, valid_api_key): wrapper = SendGridClientWrapper(valid_api_key) with pytest.raises(UnknownRequestMethodException): wrapper._call(api_endpoint=VALID_ENDPOINT, method=99)