diff --git a/app/inbound_number/rest.py b/app/inbound_number/rest.py index becaf21fc..24b2445c2 100644 --- a/app/inbound_number/rest.py +++ b/app/inbound_number/rest.py @@ -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 diff --git a/tests/app/inbound_number/test_rest.py b/tests/app/inbound_number/test_rest.py index c237df448..3ffd691ab 100644 --- a/tests/app/inbound_number/test_rest.py +++ b/tests/app/inbound_number/test_rest.py @@ -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')