def test_response_content_type_handling(self, content_type, json, data): from bigchaindb_driver.connection import Connection url = 'http://dummy' connection = Connection(node_url=url) with RequestsMock() as requests_mock: requests_mock.add('GET', url, json=json) response = connection.request('GET') assert response.status_code == 200 assert response.headers['Content-Type'] == content_type assert response.data == data
def test_request_with_headers(self, headers): from bigchaindb_driver.connection import Connection url = 'http://dummy' connection = Connection(node_url=url, headers=headers) with RequestsMock() as requests_mock: requests_mock.add('GET', url, adding_headers=headers) response = connection.request('GET') assert response.status_code == 200 del response.headers['Content-type'] assert response.headers == headers