Skip to content

Commit d71094d

Browse files
committed
fixes tests
1 parent e547cd1 commit d71094d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/service-library/tests/aiohttp/test_rest_responses.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
HTTPOk,
1818
)
1919
from common_library.error_codes import ErrorCodeStr, create_error_code
20-
from servicelib.aiohttp.rest_responses import create_http_error, exception_to_response
20+
from servicelib.aiohttp.rest_responses import (
21+
MAX_STATUS_MESSAGE_LENGTH,
22+
create_http_error,
23+
exception_to_response,
24+
)
2125
from servicelib.aiohttp.web_exceptions_extension import (
2226
_STATUS_CODE_TO_HTTP_ERRORS,
2327
get_http_error_class_or_none,
@@ -136,10 +140,13 @@ def tests_exception_to_response(
136140
"Message\nwith\nnewlines",
137141
"Message with newlines",
138142
), # Newlines are replaced with spaces
139-
("A" * 100, "A" * 47 + "..."), # Long message gets truncated with ellipsis
140143
(
141-
"Line1\nLine2\nLine3" + "X" * 100,
142-
"Line1 Line2 Line3" + "X" * 30 + "...",
144+
"A" * (MAX_STATUS_MESSAGE_LENGTH + 1),
145+
"A" * (MAX_STATUS_MESSAGE_LENGTH - 3) + "...",
146+
), # Long message gets truncated with ellipsis
147+
(
148+
"Line1\nLine2\nLine3" + "X" * (MAX_STATUS_MESSAGE_LENGTH + 1),
149+
"Line1 Line2 Line3" + "X" * (MAX_STATUS_MESSAGE_LENGTH - 20) + "...",
143150
), # Combined case: newlines and truncation with ellipsis
144151
],
145152
ids=[

0 commit comments

Comments
 (0)