From 74d49d19a3f19c993bf5557dc937e4eb7f0ac9a8 Mon Sep 17 00:00:00 2001 From: p1c2u Date: Sat, 1 May 2021 00:37:39 +0100 Subject: [PATCH] Falcon2 for python2 tests --- requirements_dev.txt | 3 ++- tests/integration/contrib/falcon/conftest.py | 2 +- tests/integration/contrib/falcon/test_falcon_middlewares.py | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 5ee74a8..c55a939 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,7 +2,8 @@ mock==2.0.0 pytest==3.5.0 pytest-flake8 pytest-cov==2.5.1 -falcon==3.0.0 +falcon==2.0.0; python_version<"3.0" +falcon==3.0.0; python_version>="3.0" flask django==2.2.18; python_version>="3.0" requests==2.22.0 diff --git a/tests/integration/contrib/falcon/conftest.py b/tests/integration/contrib/falcon/conftest.py index 6513356..5ad0503 100644 --- a/tests/integration/contrib/falcon/conftest.py +++ b/tests/integration/contrib/falcon/conftest.py @@ -43,7 +43,7 @@ def response_factory(environ_factory): data, status_code=200, content_type='application/json'): options = ResponseOptions() resp = Response(options) - resp.text = data + resp.body = data resp.content_type = content_type resp.status = HTTP_200 return resp diff --git a/tests/integration/contrib/falcon/test_falcon_middlewares.py b/tests/integration/contrib/falcon/test_falcon_middlewares.py index b55a78b..a234835 100644 --- a/tests/integration/contrib/falcon/test_falcon_middlewares.py +++ b/tests/integration/contrib/falcon/test_falcon_middlewares.py @@ -1,6 +1,6 @@ from json import dumps -from falcon import App +from falcon import API as App from falcon.testing import TestClient import pytest @@ -67,7 +67,7 @@ class TestFalconOpenAPIMiddleware(object): }) response.content_type = MEDIA_HTML response.status = HTTP_200 - response.text = 'success' + response.body = 'success' self.view_response_callable = view_response_callable headers = {'Content-Type': 'application/json'} result = client.simulate_get( @@ -190,7 +190,7 @@ class TestFalconOpenAPIMiddleware(object): }) response.status = HTTP_200 response.content_type = MEDIA_JSON - response.text = dumps({ + response.body = dumps({ 'data': 'data', }) self.view_response_callable = view_response_callable