Commit f4f706d5 authored by Pawel Boening's avatar Pawel Boening Committed by Leonard Marschke

format huge messages

parent b2f2ee36
......@@ -44,7 +44,7 @@ class TestFuzzing(BaseTest):
self.assertResponse(500, '{}\r\n'.format(fuzzy_input))
def test_huge_input(self):
fuzzy_input = 'A' * 10**4
fuzzy_input = 'A' * 10**6
self.assertResponse(500, '{}\r\n'.format(fuzzy_input))
def test_sentry_issue_49(self):
......
......@@ -35,12 +35,15 @@ class BaseTest(unittest.TestCase):
raise self.failureException("{} not in {}: {}".format(value, expected_list, msg))
def assertResponse(self, expected_code, message=None): # pylint: disable=invalid-name
def format_message(message):
if not message or isinstance(message, bytes):
return message
if message[-2:] == '\r\n':
return message[:-2]
return message
def format_message(form_message):
if not form_message or isinstance(form_message, bytes):
return form_message
if form_message[-2:] == '\r\n':
message = form_message[:-2]
if len(form_message) > 100:
form_message = '{} ..[{}x].. {}'.format(form_message[:50], len(form_message)-100, form_message[-50:])
return form_message
if isinstance(expected_code, int):
expected_code = [expected_code]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment