From 73225c3acce2c93dbbbca2e4d2acb9729f7d8e98 Mon Sep 17 00:00:00 2001 From: Aviram Hassan <41201924+aviramha@users.noreply.github.com> Date: Wed, 18 Mar 2020 10:33:30 +0200 Subject: [PATCH] Update tests/test_requests.py @florimondmanca better test Co-Authored-By: Florimond Manca --- tests/test_requests.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index caa2bf57..3381249e 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -288,18 +288,12 @@ def test_request_cookies(): def test_invalid_cookie(): async def app(scope, receive, send): request = Request(scope, receive) - if not request.cookies: - response = Response("ok", media_type="text/plain") - else: - response = Response("not", media_type="text/plain") + response = JSONResponse({"cookies": request.cookies}) await response(scope, receive, send) client = TestClient(app) response = client.get("/", cookies={"invalid/cookie": "test", "valid": "test2"}) - assert response.text == "ok" - - response = client.get("/", cookies={"valid": "test2"}) - assert response.text == "not" + assert response.json() == {"cookies": {}} def test_chunked_encoding(): -- 2.47.2