Граф коммитов

122 Коммитов

Автор SHA1 Сообщение Дата
John Whitlock c13b7e6f7a
Remove function call from @responses.activate
The upgrade from response 0.23.3 to 0.24.0 removed the typing override
that handled `@responses.activate()`. Remove the unneeded call to allow
mypy to detect the correct types.
2023-11-06 16:38:13 -06:00
Se Yeon Kim 6cdd01301d
Migration to remove remaining_minutes
This column has not been used since we introduced remaining_seconds and the Django model property remaining_minutes
Fix MPP-3448
2023-09-26 14:56:18 -05:00
Se Yeon Kim fda00d8d5a
Code removal needs to be deployed before the DB changes for deletions
Fix MPP-3448
2023-09-21 13:02:04 -05:00
Se Yeon Kim a74ed478dc
Remove Django field deprecated_remaining_minutes and delete DB column remaining_minutes
Fix MPP-3448
2023-09-21 11:19:49 -05:00
John Whitlock 7466c6ea0d
Change option from --yes to --force 2023-07-20 16:05:56 -05:00
John Whitlock c21032df0a
Use make_phone_test_user in management tests 2023-07-20 16:00:21 -05:00
John Whitlock 680da50d0c
Move the helper class _PhoneData below the Command 2023-07-20 16:00:21 -05:00
John Whitlock 63eb069529
Switch from "default delete" to "default confirm"
Previously, the default behaviour was to delete data, and the user could
pass --dry-run to just display results.

Now the default behaviour is to ask for confirmation, and the user can
pass --yes to skip it.
2023-07-20 16:00:21 -05:00
John Whitlock 84d1d91dda
WIP: converting to --yes 2023-07-20 16:00:21 -05:00
John Whitlock 98bf1170e4
Add PHONES_NO_CLIENT_CALLS_IN_TEST setting 2023-07-20 16:00:21 -05:00
John Whitlock 51cc595f1c
Change .has_phone_data to .has_data 2023-07-20 16:00:21 -05:00
John Whitlock eb4add2b72
Handle disabled phones 2023-07-20 16:00:21 -05:00
John Whitlock 9315746f54
Add delete_phone_data management command 2023-07-20 16:00:21 -05:00
John Whitlock 0fcf1a0695
Add type hints 2023-07-20 16:00:21 -05:00
groovecoder ca7655fde5 remove un-used phones_config; fix mypy annotations 2023-04-06 09:25:30 -05:00
groovecoder 00e21397d5 refactor: iq_utils module with send_iq_sms function
refactor: settings.IQ_PUBLISH_MESSAGE_URL
2023-04-06 09:25:30 -05:00
groovecoder 8a67c74770 fix phones.tests.model_tests when IQ_ENABLED=0 2023-04-06 09:25:30 -05:00
groovecoder 60c3a5ee4b add test for iq-sent verification codes
refactor iq_fmt up into phones.models

add new _make_real_phone_with_mock_iq helper
2023-04-06 09:25:30 -05:00
groovecoder 573c5030c2 send RealPhone verification message with iQ
Add IQ_FOR_VERIFICATION env var and setting.

Refactor api.phones.views._send_iq_sms into PhonesConfig.send_iq_sms

Use PhonesConfig.send_iq_sms to send real phone verification when
IQ_FOR_VERIFICATION is True.

Update docs for end-to-end local iQ development.
2023-04-06 09:25:30 -05:00
groovecoder 870af2ac81
fix code for black 23.x 2023-03-13 14:04:44 -05:00
groovecoder c3eca0ced6
fix relaynumber.vendor migration for default value 2023-03-09 16:14:57 -06:00
groovecoder 8c82a2c22f
mark iq tests for db access; fix mypy error 2023-03-09 16:14:57 -06:00
groovecoder 2829e834e8
add RelayNumber.vendor and tests 2023-03-09 16:14:56 -06:00
groovecoder 6152d93353
for MPP-2812: use iQ API for iQ-powered numbers 2023-03-09 16:14:56 -06:00
John Whitlock e68f894a7c Move Twilio Number SID to mock_twilio_client
This allows removing repetative setup from relay number creation tests.
Continue removing lines by removing shorter mock names that are just
used once.
2023-01-23 07:39:39 -06:00
John Whitlock 8230a91162 Add CachedList for cached list access 2023-01-23 07:39:39 -06:00
John Whitlock 5d2e141e42 Skip registration if messaging service is unset
Many existing tests rely on acquiring a relay phone number without
TWILIO_MESSAGING_SERVICE_ID being set. Handle this by skipping
registration and logging a warning.
2023-01-23 07:39:39 -06:00
John Whitlock 709f356dd9 Change TWILIO_MESSAGING_SERVICE_SID to CSV
Change the Twilio messaging service IDs settings to a comma-separated
list. Legacy values will be treated as a list on one entry.

When registeting a US relay phone mask with a messaging service, try
each service in order, stopping after the first successful service. Take
note of full services in the cache to avoid checking them.
2023-01-23 07:39:39 -06:00
John Whitlock a7c8d106ff Test full messaging pool 2023-01-23 07:39:39 -06:00
John Whitlock 5d72ad973d Add real_phone_us fixture
Add fixture that creates a real phone number and resets the Twilio
client mock, to clear the sent confirmation message. Use the fixture in
tests of allocating a US-based relay number. Refactor tests to remove
redundant assertions and test all mocked parameters.
2023-01-23 07:39:39 -06:00
John Whitlock a71465975f Narrow twilio_client mock
Rename to mock_twilio_client, and remove the unnecessary reassignments
in tests. Restrict the mocked interfaces to those used by phones models.
2023-01-23 07:39:39 -06:00
John Whitlock 8d28e9230d flake8 fixes 2023-01-23 07:39:39 -06:00
groovecoder 3ef028e93c update PhonesConfig.twiml_app to assert return type 2022-12-16 09:41:11 -06:00
John Whitlock 2726ac9bf7
Avoid circular import 2022-11-30 17:11:55 -06:00
John Whitlock d71d133c8c
Lint and add types for _handle_sms_reply 2022-11-30 17:11:54 -06:00
John Whitlock cbcf8202a7
Move storing_phone_log to RelayNumber property 2022-11-30 17:11:54 -06:00
John Whitlock 5be00beb2b Use decouple.CSV for comma-separated settings
decouple.CSV will convert a string with a comma-separated value into a
list, and will remove empty strings ("foo," -> ["foo"]).
2022-11-28 14:48:51 -06:00
John Whitlock be3425e379
Track last text and last call times
Add nullable last_call_date and last_text_date to InboundContact. Set
when a call or text is received.

Use last_inbound_contact and last_text_date to find the last texter.
2022-11-16 19:37:18 -06:00
John Whitlock 4b241fb67b Switch Twilio clients to initialize on first use
Instead of initializing Twilio clients on application startup,
initialize them on first use. This benefits applications that
do not use phones, such as ./manage.py migrate. They startup faster, and
do not need Twilio account settings in the environment.
2022-11-09 10:29:47 -06:00
groovecoder 6bfb76d312
fix MPP-2390: sms and voice status callbacks delete data from twilio 2022-10-24 14:34:17 -05:00
groovecoder 24d44089a5 first phones_* stats pings 2022-10-11 16:42:50 -05:00
Se Yeon Kim 8e485f0dae
Use math instead of if statement
to return 0 or positive int for remaining_minutes
2022-10-10 16:59:33 -05:00
Se Yeon Kim 4c53c9f86c
Return non-negative integer when converting remaining seconds to minutes 2022-10-10 16:59:32 -05:00
John Whitlock 6abb5a9437
MPP-2332: Handle dupe US A2P 10DLC registration
Ignore error 21710 when a US relay number is already registered with the
US A2P 10DLC campaign.
2022-10-06 12:37:01 -05:00
John Whitlock d624b1a0d4
Add unique index for RelayNumber.number 2022-10-06 12:37:01 -05:00
John Whitlock 915c6512a2
Test ValidationError messages 2022-10-06 12:37:01 -05:00
John Whitlock 4aa5d476bd
Raise ValidationError for dupe RelayNumber.number 2022-10-06 12:37:01 -05:00
John Whitlock e9f5b57ec5
Enforce one RelayNumber per user 2022-10-06 12:37:01 -05:00
John Whitlock b36235cb5b
Refactor to use pytest.raises
pytest.raises is more explicit than a try/except block, and fails
automatically when the exception is not raised.
2022-10-06 12:37:01 -05:00
John Whitlock f8776e397a Add random numbers to suggested relay numbers 2022-10-06 10:28:05 -05:00