From f9bb21803b39ba6ccb27a13dcf629f263f157558 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Sun, 21 Mar 2021 03:09:24 +0200 Subject: [PATCH] Add tests --- tests/test_request.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_request.py b/tests/test_request.py index 74598f914f..5b79b1e3f9 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -35,6 +35,27 @@ def test_request_id_defaults_uuid(): assert request.id == request.id == request._id +def test_name_none(): + request = Request(b"/", {}, None, "GET", None, None) + + assert request.name is None + + +def test_name_from_route(): + request = Request(b"/", {}, None, "GET", None, None) + route = Mock() + request.route = route + + assert request.name == route.name + + +def test_name_from_set(): + request = Request(b"/", {}, None, "GET", None, None) + request._name = "foo" + + assert request.name == "foo" + + @pytest.mark.parametrize( "request_id,expected_type", (