mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
notify-api-412 use black to enforce python coding style
This commit is contained in:
@@ -15,11 +15,14 @@ def _gen_mock_field(x):
|
||||
return Mock(data=x)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("email", [ # TODO: update with email_domains.txt
|
||||
'test@gsa.gov',
|
||||
'test@abc.gov',
|
||||
'test@xyz.gov'
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"email",
|
||||
[ # TODO: update with email_domains.txt
|
||||
"test@gsa.gov",
|
||||
"test@abc.gov",
|
||||
"test@xyz.gov",
|
||||
],
|
||||
)
|
||||
def test_valid_list_of_white_list_email_domains(
|
||||
client_request,
|
||||
email,
|
||||
@@ -28,13 +31,16 @@ def test_valid_list_of_white_list_email_domains(
|
||||
email_domain_validators(None, _gen_mock_field(email))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("email", [ # TODO: update with email_domains.txt
|
||||
'test@gov.gsa',
|
||||
'test@gmail.co',
|
||||
'test@mail.co',
|
||||
'test@amazonses.co',
|
||||
'test@amazon.com'
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"email",
|
||||
[ # TODO: update with email_domains.txt
|
||||
"test@gov.gsa",
|
||||
"test@gmail.co",
|
||||
"test@mail.co",
|
||||
"test@amazonses.co",
|
||||
"test@amazon.com",
|
||||
],
|
||||
)
|
||||
def test_invalid_list_of_white_list_email_domains(
|
||||
client_request,
|
||||
email,
|
||||
@@ -49,35 +55,38 @@ def test_for_commas_in_placeholders(
|
||||
client_request,
|
||||
):
|
||||
with pytest.raises(ValidationError) as error:
|
||||
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name,date))'))
|
||||
assert str(error.value) == 'You cannot put commas between double brackets'
|
||||
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name))'))
|
||||
NoCommasInPlaceHolders()(None, _gen_mock_field("Hello ((name,date))"))
|
||||
assert str(error.value) == "You cannot put commas between double brackets"
|
||||
NoCommasInPlaceHolders()(None, _gen_mock_field("Hello ((name))"))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('msg', ['The quick brown fox', 'Thé “quick” bröwn fox\u200B'])
|
||||
@pytest.mark.parametrize("msg", ["The quick brown fox", "Thé “quick” bröwn fox\u200B"])
|
||||
def test_sms_character_validation(client_request, msg):
|
||||
OnlySMSCharacters(template_type='sms')(None, _gen_mock_field(msg))
|
||||
OnlySMSCharacters(template_type="sms")(None, _gen_mock_field(msg))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('data, err_msg', [
|
||||
(
|
||||
'∆ abc 📲 def 📵 ghi',
|
||||
@pytest.mark.parametrize(
|
||||
"data, err_msg",
|
||||
[
|
||||
(
|
||||
'You cannot use ∆, 📲 or 📵 in text messages. '
|
||||
'They will not show up properly on everyone’s phones.'
|
||||
)
|
||||
),
|
||||
(
|
||||
'📵',
|
||||
"∆ abc 📲 def 📵 ghi",
|
||||
(
|
||||
"You cannot use ∆, 📲 or 📵 in text messages. "
|
||||
"They will not show up properly on everyone’s phones."
|
||||
),
|
||||
),
|
||||
(
|
||||
'You cannot use 📵 in text messages. '
|
||||
'It will not show up properly on everyone’s phones.'
|
||||
)
|
||||
),
|
||||
])
|
||||
"📵",
|
||||
(
|
||||
"You cannot use 📵 in text messages. "
|
||||
"It will not show up properly on everyone’s phones."
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_non_sms_character_validation(data, err_msg, client_request):
|
||||
with pytest.raises(ValidationError) as error:
|
||||
OnlySMSCharacters(template_type='sms')(None, _gen_mock_field(data))
|
||||
OnlySMSCharacters(template_type="sms")(None, _gen_mock_field(data))
|
||||
|
||||
assert str(error.value) == err_msg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user