mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 21:48:49 -04:00
add test to ensure that updating other things doesnt affect sms sender
This commit is contained in:
@@ -188,7 +188,7 @@ class Service(db.Model, Versioned):
|
|||||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||||
reply_to_email_address = db.Column(db.Text, index=False, unique=False, nullable=True)
|
reply_to_email_address = db.Column(db.Text, index=False, unique=False, nullable=True)
|
||||||
letter_contact_block = db.Column(db.Text, index=False, unique=False, nullable=True)
|
letter_contact_block = db.Column(db.Text, index=False, unique=False, nullable=True)
|
||||||
sms_sender = db.Column(db.String(11), nullable=False, default=lambda: current_app.config['FROM_NUMBER'])
|
sms_sender = db.Column(db.String(11), nullable=True, default=lambda: current_app.config['FROM_NUMBER'])
|
||||||
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
|
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
|
||||||
organisation = db.relationship('Organisation')
|
organisation = db.relationship('Organisation')
|
||||||
dvla_organisation_id = db.Column(
|
dvla_organisation_id = db.Column(
|
||||||
|
|||||||
@@ -1735,3 +1735,19 @@ def test_update_service_does_not_call_send_notification_when_restricted_not_chan
|
|||||||
|
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
assert not send_notification_mock.called
|
assert not send_notification_mock.called
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_service_works_when_sms_sender_is_null(sample_service, client, mocker):
|
||||||
|
sample_service.sms_sender = None
|
||||||
|
data = {'name': 'new name'}
|
||||||
|
|
||||||
|
resp = client.post(
|
||||||
|
'service/{}'.format(sample_service.id),
|
||||||
|
data=json.dumps(data),
|
||||||
|
headers=[create_authorization_header()],
|
||||||
|
content_type='application/json'
|
||||||
|
)
|
||||||
|
|
||||||
|
assert resp.status_code == 200
|
||||||
|
# make sure it wasn't changed to not-null under the hood
|
||||||
|
assert sample_service.sms_sender is None
|
||||||
|
|||||||
Reference in New Issue
Block a user