Falcon2 for python2 tests

This commit is contained in:
p1c2u 2021-05-01 00:37:39 +01:00
parent 2c864595e5
commit 74d49d19a3
3 changed files with 6 additions and 5 deletions

View file

@ -2,7 +2,8 @@ mock==2.0.0
pytest==3.5.0 pytest==3.5.0
pytest-flake8 pytest-flake8
pytest-cov==2.5.1 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 flask
django==2.2.18; python_version>="3.0" django==2.2.18; python_version>="3.0"
requests==2.22.0 requests==2.22.0

View file

@ -43,7 +43,7 @@ def response_factory(environ_factory):
data, status_code=200, content_type='application/json'): data, status_code=200, content_type='application/json'):
options = ResponseOptions() options = ResponseOptions()
resp = Response(options) resp = Response(options)
resp.text = data resp.body = data
resp.content_type = content_type resp.content_type = content_type
resp.status = HTTP_200 resp.status = HTTP_200
return resp return resp

View file

@ -1,6 +1,6 @@
from json import dumps from json import dumps
from falcon import App from falcon import API as App
from falcon.testing import TestClient from falcon.testing import TestClient
import pytest import pytest
@ -67,7 +67,7 @@ class TestFalconOpenAPIMiddleware(object):
}) })
response.content_type = MEDIA_HTML response.content_type = MEDIA_HTML
response.status = HTTP_200 response.status = HTTP_200
response.text = 'success' response.body = 'success'
self.view_response_callable = view_response_callable self.view_response_callable = view_response_callable
headers = {'Content-Type': 'application/json'} headers = {'Content-Type': 'application/json'}
result = client.simulate_get( result = client.simulate_get(
@ -190,7 +190,7 @@ class TestFalconOpenAPIMiddleware(object):
}) })
response.status = HTTP_200 response.status = HTTP_200
response.content_type = MEDIA_JSON response.content_type = MEDIA_JSON
response.text = dumps({ response.body = dumps({
'data': 'data', 'data': 'data',
}) })
self.view_response_callable = view_response_callable self.view_response_callable = view_response_callable