changed None to return empty string instead of null string

This commit is contained in:
Arnulfo Solis
2018-02-01 11:52:55 +01:00
parent 8b23b5d389
commit 2135294e2e
3 changed files with 17 additions and 3 deletions

View File

@@ -63,6 +63,10 @@ def json_app():
async def test(request):
return json(JSON_DATA)
@app.delete("/")
async def test_delete(request):
return json(None, status=204)
return app
@@ -73,6 +77,14 @@ def test_json_response(json_app):
assert response.text == json_dumps(JSON_DATA)
assert response.json == JSON_DATA
def test_no_content(json_app):
request, response = json_app.test_client.delete('/')
assert response.status == 204
assert response.text == ''
assert response.headers['Content-Length'] == '0'
@pytest.fixture
def streaming_app():
app = Sanic('streaming')