From 5c4a67c8b89025d43fb23e3b70b3e3493d045b55 Mon Sep 17 00:00:00 2001 From: PandaFeeder Date: Sat, 13 May 2017 19:26:04 +0800 Subject: [PATCH] fix typo and unproper test --- tests/test_mounted_middleware.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_mounted_middleware.py b/tests/test_mounted_middleware.py index a2be2fbd..87180982 100644 --- a/tests/test_mounted_middleware.py +++ b/tests/test_mounted_middleware.py @@ -42,7 +42,7 @@ def test_early_response_from_mounted_request_middleware(): request, response = app.test_client.get('/') - assert response.text == "reponse from early_request_middleware" + assert response.text == "response from early_request_middleware" assert results[0] == 1 assert len(results) == 1 @@ -95,7 +95,7 @@ def test_mounted_request_middleware_parameter(): request, response = app.test_client.get('/42') - assert results[0] == 42 + assert results[0] == str(42) assert response.text == "OK" @@ -106,7 +106,7 @@ def test_mounted_response_middleware(): results = [] async def response_middleware(request, response): - response["response_middleware_added"] = "TEST" + response.response_middleware_added = "TEST" @app.route('/', middleware={"response": response_middleware}) async def handler(request): @@ -114,7 +114,7 @@ def test_mounted_response_middleware(): request, response = app.test_client.get('/') - assert response["response_middleware_added"] == "TEST" + assert response.response_middleware_added == "TEST" def test_early_response_from_mounted_response_middleware(): @@ -149,8 +149,7 @@ def test_early_response_from_mounted_response_middleware(): for i,v in enumerate(added): if i != 3: assert results[i] == added[i] - else: - assert results[i] != added[i] + assert len(results) == 3 def test_mounted_response_middleware_parameter(): app = Sanic("test_mounted_response_middleware_parameter") @@ -166,7 +165,7 @@ def test_mounted_response_middleware_parameter(): request, response = app.test_client.get('/42') - assert results[0] == 42 + assert results[0] == str(42) assert response.text == "OK"