Tests: style.

This commit is contained in:
Andrei Zeliankou
2020-11-19 05:21:22 +00:00
parent 25219a7ece
commit e154d7a3a2

View File

@@ -154,54 +154,58 @@ Connection: close
def test_http_header_field_leading_sp(self): def test_http_header_field_leading_sp(self):
self.load('empty') self.load('empty')
resp = self.get( assert (
headers={ self.get(
'Host': 'localhost', headers={
' Custom-Header': 'blah', 'Host': 'localhost',
'Connection': 'close', ' Custom-Header': 'blah',
} 'Connection': 'close',
) }
)['status']
assert resp['status'] == 400, 'field leading sp' == 400
), 'field leading sp'
def test_http_header_field_leading_htab(self): def test_http_header_field_leading_htab(self):
self.load('empty') self.load('empty')
resp = self.get( assert (
headers={ self.get(
'Host': 'localhost', headers={
'\tCustom-Header': 'blah', 'Host': 'localhost',
'Connection': 'close', '\tCustom-Header': 'blah',
} 'Connection': 'close',
) }
)['status']
assert resp['status'] == 400, 'field leading htab' == 400
), 'field leading htab'
def test_http_header_field_trailing_sp(self): def test_http_header_field_trailing_sp(self):
self.load('empty') self.load('empty')
resp = self.get( assert (
headers={ self.get(
'Host': 'localhost', headers={
'Custom-Header ': 'blah', 'Host': 'localhost',
'Connection': 'close', 'Custom-Header ': 'blah',
} 'Connection': 'close',
) }
)['status']
assert resp['status'] == 400, 'field trailing sp' == 400
), 'field trailing sp'
def test_http_header_field_trailing_htab(self): def test_http_header_field_trailing_htab(self):
self.load('empty') self.load('empty')
resp = self.get( assert (
headers={ self.get(
'Host': 'localhost', headers={
'Custom-Header\t': 'blah', 'Host': 'localhost',
'Connection': 'close', 'Custom-Header\t': 'blah',
} 'Connection': 'close',
) }
)['status']
assert resp['status'] == 400, 'field trailing htab' == 400
), 'field trailing htab'
def test_http_header_content_length_big(self): def test_http_header_content_length_big(self):
self.load('empty') self.load('empty')