def test_returns_document_with_hal_document(self): app = Flask(__name__) with app.test_request_context(): d = document.Document() r = HALResponse.force_type(d, {}) expected = json.dumps({'_links': {'self': {'href': '/'}}}) assert isinstance(r, Response) assert r.headers['Content-Type'] == 'application/hal+json' assert r.data.decode("utf-8") == expected
def test_returns_document_with_hal_document(self): app = Flask(__name__) with app.test_request_context(): d = document.Document() r = HALResponse.force_type(d, {}) expected = json.dumps({ '_links': { 'self': { 'href': '/' } } }) assert isinstance(r, Response) assert r.headers['Content-Type'] == 'application/hal+json' assert r.data.decode("utf-8") == expected
def test_returns_standard_response(self): r = HALResponse.force_type(Response('foo'), {}) assert isinstance(r, Response) assert r.headers['Content-Type'] == 'text/html; charset=utf-8' assert r.data.decode("utf-8") == 'foo'