mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
Can remove sms sender.
This commit is contained in:
@@ -327,5 +327,5 @@ class ServiceSmsSender(Form):
|
|||||||
|
|
||||||
def validate_sms_sender(form, field):
|
def validate_sms_sender(form, field):
|
||||||
import re
|
import re
|
||||||
if not re.match('^[a-zA-Z0-9\s]+$', field.data):
|
if field.data and not re.match('^[a-zA-Z0-9\s]+$', field.data):
|
||||||
raise ValidationError('Sms text message sender can only contain alpha-numeric characters')
|
raise ValidationError('Sms text message sender can only contain alpha-numeric characters')
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ def test_sms_sender_form_validation(app_, mock_get_user_by_email):
|
|||||||
form.validate()
|
form.validate()
|
||||||
assert not form.errors
|
assert not form.errors
|
||||||
|
|
||||||
|
form.sms_sender.data = ''
|
||||||
|
form.validate()
|
||||||
|
assert not form.errors
|
||||||
|
|
||||||
form.sms_sender.data = 'morethanelevenchars'
|
form.sms_sender.data = 'morethanelevenchars'
|
||||||
form.validate()
|
form.validate()
|
||||||
assert "Text message sender can't be longer than 11 characters" == form.errors['sms_sender'][0]
|
assert "Text message sender can't be longer than 11 characters" == form.errors['sms_sender'][0]
|
||||||
|
|||||||
Reference in New Issue
Block a user