mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-29 13:42:15 -04:00
Localize notification_utils to the admin
This changeset pulls in all of the notification_utils code directly into the admin and removes it as an external dependency. We are doing this to cut down on operational maintenance of the project and will begin removing parts of it no longer needed for the admin. Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
47
tests/notifications_utils/test_safe_string.py
Normal file
47
tests/notifications_utils/test_safe_string.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import pytest
|
||||
|
||||
from notifications_utils.safe_string import (
|
||||
make_string_safe_for_email_local_part,
|
||||
make_string_safe_for_id,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"unsafe_string, expected_safe",
|
||||
[
|
||||
("name with spaces", "name.with.spaces"),
|
||||
("singleword", "singleword"),
|
||||
("UPPER CASE", "upper.case"),
|
||||
("Service - with dash", "service.with.dash"),
|
||||
("lots of spaces", "lots.of.spaces"),
|
||||
("name.with.dots", "name.with.dots"),
|
||||
("name-with-other-delimiters", "namewithotherdelimiters"),
|
||||
(".leading", "leading"),
|
||||
("trailing.", "trailing"),
|
||||
("üńïçödë wördś", "unicode.words"),
|
||||
],
|
||||
)
|
||||
def test_email_safe_return_dot_separated_email_local_part(unsafe_string, expected_safe):
|
||||
assert make_string_safe_for_email_local_part(unsafe_string) == expected_safe
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"unsafe_string, expected_safe",
|
||||
[
|
||||
("name with spaces", "name-with-spaces"),
|
||||
("singleword", "singleword"),
|
||||
("UPPER CASE", "upper-case"),
|
||||
("Service - with dash", "service---with-dash"),
|
||||
("lots of spaces", "lots-of-spaces"),
|
||||
("name.with.dots", "namewithdots"),
|
||||
("name-with-dashes", "name-with-dashes"),
|
||||
("N. London", "n-london"),
|
||||
(".leading", "leading"),
|
||||
("-leading", "-leading"),
|
||||
("trailing.", "trailing"),
|
||||
("trailing-", "trailing-"),
|
||||
("üńïçödë wördś", "unicode-words"),
|
||||
],
|
||||
)
|
||||
def test_id_safe_return_dash_separated_string(unsafe_string, expected_safe):
|
||||
assert make_string_safe_for_id(unsafe_string) == expected_safe
|
||||
Reference in New Issue
Block a user