mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Update post_allocate_inbound_number to set the service_sms_sender in the case when a service had the number, then it was set to inactive and now there is a request to turn it back on (or click allow inbound sms a couple of times on the front end)
This commit is contained in:
@@ -36,6 +36,8 @@ def post_allocate_inbound_number(service_id):
|
||||
if inbound_number:
|
||||
if not inbound_number.active:
|
||||
dao_set_inbound_number_active_flag(service_id, active=True)
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
insert_or_update_service_sms_sender(service, inbound_number.number, inbound_number.id)
|
||||
return jsonify(), 204
|
||||
else:
|
||||
return jsonify(), 200
|
||||
|
||||
@@ -114,25 +114,6 @@ def test_rest_set_inbound_number_active_flag_off(
|
||||
assert not inbound_number_from_db.active
|
||||
|
||||
|
||||
def test_allocate_inbound_number_insert_update_service_sms_sender(
|
||||
admin_request, notify_db_session
|
||||
):
|
||||
service = create_service()
|
||||
inbound_number = create_inbound_number(number='123')
|
||||
|
||||
admin_request.post(
|
||||
'inbound_number.post_allocate_inbound_number',
|
||||
_expected_status=204,
|
||||
service_id=service.id
|
||||
)
|
||||
|
||||
service_sms_senders = ServiceSmsSender.query.all()
|
||||
assert len(service_sms_senders) == 1
|
||||
assert service_sms_senders[0].sms_sender == inbound_number.number
|
||||
assert service_sms_senders[0].inbound_number_id == inbound_number.id
|
||||
assert service_sms_senders[0].is_default
|
||||
|
||||
|
||||
def test_allocate_inbound_number_to_service(admin_request, notify_db_session):
|
||||
service = create_service()
|
||||
inbound_number = create_inbound_number(number='1235468')
|
||||
|
||||
Reference in New Issue
Block a user