Merge pull request #1306 from GSA/add-sim-numbers-totrial

Add simulated numbers to allow list in trial mode
This commit is contained in:
Carlo Costino
2024-03-14 12:51:19 -04:00
committed by GitHub

View File

@@ -1,4 +1,3 @@
import itertools
import time
import uuid
from string import ascii_uppercase
@@ -517,19 +516,27 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
current_service,
show_recipient=False,
)
allow_list = []
if current_service.trial_mode:
# Adding the simulated numbers to allow list
# so they can be sent in trial mode
for user in Users(service_id):
allow_list.extend([user.name, user.mobile_number, user.email_address])
# Failed sms number
allow_list.extend(["simulated user (fail)", "+14254147167", "simulated@simulated.gov"])
# Success sms number
allow_list.extend(
["simulated user (success)", "+14254147755", "simulatedtwo@simulated.gov"]
)
else:
allow_list = None
recipients = RecipientCSV(
contents,
template=template or simplifed_template,
max_initial_rows_shown=50,
max_errors_shown=50,
guestlist=(
itertools.chain.from_iterable(
[user.name, user.mobile_number, user.email_address]
for user in Users(service_id)
)
if current_service.trial_mode
else None
),
guestlist=allow_list,
remaining_messages=remaining_messages,
allow_international_sms=current_service.has_permission("international_sms"),
)