fix non-gsm error message

Use `it`/`they` depending on how many different characters you've used
Also don't wrap the message with quotes, as it looks confusing and
potentialy implies that you can't use apostrophes
This commit is contained in:
Leo Hemsted
2017-02-15 16:21:14 +00:00
parent 9046ec3bbc
commit f550699daf
3 changed files with 24 additions and 10 deletions

View File

@@ -146,14 +146,27 @@ def test_gsm_character_validation(client, msg):
OnlyGSMCharacters()(None, _gen_mock_field(msg))
def test_non_gsm_character_validation(client):
@pytest.mark.parametrize('data, err_msg', [
(
'∆ abc 📲 def 📵 ghi',
(
'You cant use ∆, 📲 or 📵 in text messages. '
'They wont show up properly on everyones phones.'
)
),
(
'📵',
(
'You cant use 📵 in text messages. '
'It wont show up properly on everyones phones.'
)
),
])
def test_non_gsm_character_validation(data, err_msg, client):
with pytest.raises(ValidationError) as error:
OnlyGSMCharacters()(None, _gen_mock_field('∆ abc 📲 def 📵 ghi'))
OnlyGSMCharacters()(None, _gen_mock_field(data))
assert str(error.value) == (
'You cant use ‘∆’, ‘📲’ or ‘📵’ in text messages. '
'They wont show up properly on everyones phones.'
)
assert str(error.value) == err_msg
def test_sms_sender_form_validation(