Skip to content

Commit

Permalink
Immediately return true if PASSWORDLESS_TEST_SUPPRESSION set
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Stallmann committed Apr 16, 2020
1 parent ac1f6c6 commit 21a7147
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drfpasswordless/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ def send_sms_with_callback_token(user, mobile_token, **kwargs):
Passes silently without sending in test environment.
"""
if api_settings.PASSWORDLESS_TEST_SUPPRESSION is True:
# we assume success to prevent spamming SMS during testing.
return True

base_string = kwargs.get('mobile_message', api_settings.PASSWORDLESS_MOBILE_MESSAGE)

try:

if api_settings.PASSWORDLESS_MOBILE_NOREPLY_NUMBER:
# We need a sending number to send properly
if api_settings.PASSWORDLESS_TEST_SUPPRESSION is True:
# we assume success to prevent spamming SMS during testing.
return True

from twilio.rest import Client
twilio_client = Client(os.environ['TWILIO_ACCOUNT_SID'], os.environ['TWILIO_AUTH_TOKEN'])
Expand Down

0 comments on commit 21a7147

Please sign in to comment.