Add tests for is_entity_header
and is_hop_by_hop_header
helper functions (#1410)
This commit is contained in:
parent
cc3edb90dc
commit
f89ba1d39f
|
@ -1,4 +1,4 @@
|
||||||
from sanic.helpers import has_message_body
|
from sanic import helpers
|
||||||
|
|
||||||
|
|
||||||
def test_has_message_body():
|
def test_has_message_body():
|
||||||
|
@ -11,4 +11,26 @@ def test_has_message_body():
|
||||||
(400, True),
|
(400, True),
|
||||||
)
|
)
|
||||||
for status_code, expected in tests:
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user