mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Stop escaping special characters in inbound
At least one of our providers gives us messages with special characters escaped, ie a newline comes through as `\n`, not a literal newline. We shouldn’t be showing these backslashes to any of our users. Python has built in codecs for dealing with encoding/decoding of strings – see https://docs.python.org/3/library/codecs.html#text-encodings for details. Using these builtins is safer than trying to do anything regex or parsing-based.
This commit is contained in:
@@ -172,6 +172,25 @@ def test_inbox_showing_inbound_messages(
|
||||
)
|
||||
|
||||
|
||||
def test_inbox_handles_escaped_characters(
|
||||
client_request,
|
||||
service_one,
|
||||
mock_get_inbound_sms_with_special_characters,
|
||||
):
|
||||
|
||||
service_one['permissions'] = ['inbound_sms']
|
||||
|
||||
page = client_request.get('main.inbox', service_id=SERVICE_ONE_ID)
|
||||
|
||||
assert normalize_spaces(
|
||||
str(page.select_one('tbody tr .file-list-hint'))
|
||||
) == (
|
||||
"<span class=\"file-list-hint\">"
|
||||
"the first line's content the second line's content"
|
||||
"</span>"
|
||||
)
|
||||
|
||||
|
||||
def test_empty_inbox(
|
||||
logged_in_client,
|
||||
service_one,
|
||||
|
||||
Reference in New Issue
Block a user