Add tests for is_entity_header and is_hop_by_hop_header helper functions (#1410)

This commit is contained in:
Hasan Ramezani 2018-11-11 17:57:57 +01:00 committed by Stephen Sadowski
parent cc3edb90dc
commit f89ba1d39f

View File

@ -1,4 +1,4 @@
from sanic.helpers import has_message_body
from sanic import helpers
def test_has_message_body():
@ -11,4 +11,26 @@ def test_has_message_body():
(400, True),
)
for status_code, expected in tests:
assert has_message_body(status_code) is expected
assert helpers.has_message_body(status_code) is expected
def test_is_entity_header():
tests = (
("allow", True),
("extension-header", True),
("", False),
("test", False),
)
for header, expected in tests:
assert helpers.is_entity_header(header) is expected
def test_is_hop_by_hop_header():
tests = (
("connection", True),
("upgrade", True),
("", False),
("test", False),
)
for header, expected in tests:
assert helpers.is_hop_by_hop_header(header) is expected