-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kenneth Kehl
committed
Apr 12, 2024
1 parent
906609e
commit 0f3cdcf
Showing
14 changed files
with
93 additions
and
71 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
PhoneNumber,Name | ||
+441234123121,chris | ||
+441234123122,chris | ||
+441234123123,chris | ||
+441234123124,chris | ||
+441234123125,chris | ||
+441234123126,chris | ||
+441234123127,chris | ||
+441234123128,chris | ||
+441234123129,chris | ||
+441234123120,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris | ||
+14254147755,chris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
PHONE NUMBER, IGNORE THIS COLUMN | ||
+441234123123, nope | ||
+14254147755, nope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,14 +100,14 @@ def test_should_process_sms_job(sample_job, mocker): | |
s3.get_job_and_metadata_from_s3.assert_called_once_with( | ||
service_id=str(sample_job.service.id), job_id=str(sample_job.id) | ||
) | ||
assert encryption.encrypt.call_args[0][0]["to"] == "+441234123123" | ||
assert encryption.encrypt.call_args[0][0]["to"] == "+14254147755" | ||
assert encryption.encrypt.call_args[0][0]["template"] == str(sample_job.template.id) | ||
assert ( | ||
encryption.encrypt.call_args[0][0]["template_version"] | ||
== sample_job.template.version | ||
) | ||
assert encryption.encrypt.call_args[0][0]["personalisation"] == { | ||
"phonenumber": "+441234123123" | ||
"phonenumber": "+14254147755" | ||
} | ||
assert encryption.encrypt.call_args[0][0]["row_number"] == 0 | ||
tasks.save_sms.apply_async.assert_called_once_with( | ||
|
@@ -279,7 +279,7 @@ def test_should_process_all_sms_job(sample_job_with_placeholdered_template, mock | |
service_id=str(sample_job_with_placeholdered_template.service.id), | ||
job_id=str(sample_job_with_placeholdered_template.id), | ||
) | ||
assert encryption.encrypt.call_args[0][0]["to"] == "+441234123120" | ||
assert encryption.encrypt.call_args[0][0]["to"] == "+14254147755" | ||
assert encryption.encrypt.call_args[0][0]["template"] == str( | ||
sample_job_with_placeholdered_template.template.id | ||
) | ||
|
@@ -288,7 +288,7 @@ def test_should_process_all_sms_job(sample_job_with_placeholdered_template, mock | |
== sample_job_with_placeholdered_template.template.version | ||
) # noqa | ||
assert encryption.encrypt.call_args[0][0]["personalisation"] == { | ||
"phonenumber": "+441234123120", | ||
"phonenumber": "+14254147755", | ||
"name": "chris", | ||
} | ||
assert tasks.save_sms.apply_async.call_count == 10 | ||
|
@@ -397,7 +397,7 @@ def test_should_send_template_to_correct_sms_task_and_persist( | |
): | ||
notification = _notification_json( | ||
sample_template_with_placeholders, | ||
to="+447234123123", | ||
to="+14254147755", | ||
personalisation={"name": "Jo"}, | ||
) | ||
|
||
|
@@ -558,7 +558,7 @@ def test_should_not_save_email_if_restricted_service_and_invalid_email_address( | |
def test_should_save_sms_template_to_and_persist_with_job_id(sample_job, mocker): | ||
notification = _notification_json( | ||
sample_job.template, | ||
to="+447234123123", | ||
to="+14254147755", | ||
job_id=sample_job.id, | ||
row_number=2, | ||
) | ||
|
@@ -813,7 +813,7 @@ def test_should_use_email_template_and_persist_without_personalisation( | |
|
||
|
||
def test_save_sms_should_go_to_retry_queue_if_database_errors(sample_template, mocker): | ||
notification = _notification_json(sample_template, "+447234123123") | ||
notification = _notification_json(sample_template, "+14254147755") | ||
|
||
expected_exception = SQLAlchemyError() | ||
|
||
|
@@ -1017,7 +1017,7 @@ def test_send_inbound_sms_to_service_post_https_request_to_service( | |
inbound_sms = create_inbound_sms( | ||
service=sample_service, | ||
notify_number="0751421", | ||
user_number="447700900111", | ||
user_number="+14254147755", | ||
provider_date=datetime(2017, 6, 20), | ||
content="Here is some content", | ||
) | ||
|
@@ -1063,7 +1063,7 @@ def test_send_inbound_sms_to_service_does_not_sent_request_when_inbound_api_does | |
inbound_sms = create_inbound_sms( | ||
service=sample_service, | ||
notify_number="0751421", | ||
user_number="447700900111", | ||
user_number="+14254147755", | ||
provider_date=datetime(2017, 6, 20), | ||
content="Here is some content", | ||
) | ||
|
@@ -1084,7 +1084,7 @@ def test_send_inbound_sms_to_service_retries_if_request_returns_500( | |
inbound_sms = create_inbound_sms( | ||
service=sample_service, | ||
notify_number="0751421", | ||
user_number="447700900111", | ||
user_number="+14254147755", | ||
provider_date=datetime(2017, 6, 20), | ||
content="Here is some content", | ||
) | ||
|
@@ -1109,7 +1109,7 @@ def test_send_inbound_sms_to_service_retries_if_request_throws_unknown( | |
inbound_sms = create_inbound_sms( | ||
service=sample_service, | ||
notify_number="0751421", | ||
user_number="447700900111", | ||
user_number="+14254147755", | ||
provider_date=datetime(2017, 6, 20), | ||
content="Here is some content", | ||
) | ||
|
@@ -1134,7 +1134,7 @@ def test_send_inbound_sms_to_service_does_not_retries_if_request_returns_404( | |
inbound_sms = create_inbound_sms( | ||
service=sample_service, | ||
notify_number="0751421", | ||
user_number="447700900111", | ||
user_number="+14254147755", | ||
provider_date=datetime(2017, 6, 20), | ||
content="Here is some content", | ||
) | ||
|
@@ -1429,7 +1429,7 @@ def test_save_api_email_or_sms(mocker, sample_service, notification_type): | |
data.update({"to": "[email protected]"}) | ||
expected_queue = QueueNames.SEND_EMAIL | ||
else: | ||
data.update({"to": "+447700900855"}) | ||
data.update({"to": "+14254147755"}) | ||
expected_queue = QueueNames.SEND_SMS | ||
|
||
encrypted = encryption.encrypt(data) | ||
|
@@ -1483,7 +1483,7 @@ def test_save_api_email_dont_retry_if_notification_already_exists( | |
data.update({"to": "[email protected]"}) | ||
expected_queue = QueueNames.SEND_EMAIL | ||
else: | ||
data.update({"to": "+447700900855"}) | ||
data.update({"to": "+14254147755"}) | ||
expected_queue = QueueNames.SEND_SMS | ||
|
||
encrypted = encryption.encrypt(data) | ||
|
@@ -1576,7 +1576,7 @@ def test_save_tasks_use_cached_service_and_template( | |
NotificationType.SMS, | ||
save_api_sms, | ||
QueueNames.SEND_SMS, | ||
"+447700900855", | ||
"+14254147755", | ||
), | ||
( | ||
NotificationType.EMAIL, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ def test_should_reject_bad_phone_numbers(notify_api, sample_template, mocker): | |
@pytest.mark.parametrize( | ||
"template_type, to", | ||
[ | ||
(TemplateType.SMS, "+447700900855"), | ||
(TemplateType.SMS, "+14254147755"), | ||
(TemplateType.EMAIL, "[email protected]"), | ||
], | ||
) | ||
|
@@ -257,7 +257,7 @@ def test_should_not_send_notification_for_archived_template( | |
sample_template.archived = True | ||
dao_update_template(sample_template) | ||
json_data = json.dumps( | ||
{"to": "+447700900855", "template": sample_template.id} | ||
{"to": "+14254147755", "template": sample_template.id} | ||
) | ||
auth_header = create_service_authorization_header( | ||
service_id=sample_template.service_id | ||
|
@@ -276,7 +276,7 @@ def test_should_not_send_notification_for_archived_template( | |
@pytest.mark.parametrize( | ||
"template_type, to", | ||
[ | ||
(TemplateType.SMS, "+447700900855"), | ||
(TemplateType.SMS, "+16618675309"), | ||
(TemplateType.EMAIL, "[email protected]"), | ||
], | ||
) | ||
|
@@ -1230,6 +1230,7 @@ def test_should_allow_store_original_number_on_sms_notification( | |
assert "1" == notifications[0].to | ||
|
||
|
||
@pytest.mark.skip("We don't support international at moment") | ||
def test_should_not_allow_sending_to_international_number_without_international_permission( | ||
client, sample_template, mocker | ||
): | ||
|
@@ -1254,6 +1255,7 @@ def test_should_not_allow_sending_to_international_number_without_international_ | |
assert error_json["message"] == "Cannot send to international mobile numbers" | ||
|
||
|
||
@pytest.mark.skip("We don't support international at the moment") | ||
def test_should_allow_sending_to_international_number_with_international_permission( | ||
client, sample_service_full_permissions, mocker | ||
): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,10 +65,20 @@ def test_get_service_list(client, service_factory): | |
response = client.get("/service", headers=[auth_header]) | ||
assert response.status_code == 200 | ||
json_resp = json.loads(response.get_data(as_text=True)) | ||
assert len(json_resp["data"]) == 3 | ||
assert json_resp["data"][0]["name"] == "one" | ||
assert json_resp["data"][1]["name"] == "two" | ||
assert json_resp["data"][2]["name"] == "three" | ||
|
||
found_service_one = False | ||
found_service_two = False | ||
found_service_three = False | ||
for item in json_resp["data"]: | ||
if item["name"] == "one": | ||
found_service_one = True | ||
elif item["name"] == "two": | ||
found_service_two = True | ||
elif item["name"] == "three": | ||
found_service_three = True | ||
assert found_service_one is True | ||
assert found_service_two is True | ||
assert found_service_three is True | ||
|
||
|
||
def test_get_service_list_with_only_active_flag(client, service_factory): | ||
|
@@ -1262,7 +1272,7 @@ def test_add_existing_user_to_another_service_with_all_permissions( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
# they must exist in db first | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
@@ -1332,7 +1342,7 @@ def test_add_existing_user_to_another_service_with_send_permissions( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
||
|
@@ -1382,7 +1392,7 @@ def test_add_existing_user_to_another_service_with_manage_permissions( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
||
|
@@ -1433,7 +1443,7 @@ def test_add_existing_user_to_another_service_with_folder_permissions( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
||
|
@@ -1474,7 +1484,7 @@ def test_add_existing_user_to_another_service_with_manage_api_keys( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
||
|
@@ -1514,7 +1524,7 @@ def test_add_existing_user_to_non_existing_service_returns404( | |
name="Invited User", | ||
email_address="[email protected]", | ||
password="password", | ||
mobile_number="+4477123456", | ||
mobile_number="+14254147755", | ||
) | ||
save_model_user(user_to_add, validated_email_access=True) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ def test_notification_schema_has_correct_status(sample_notification, schema_name | |
[ | ||
("name", "New User"), | ||
("email_address", "[email protected]"), | ||
("mobile_number", "+4407700900460"), | ||
("mobile_number", "+14254147755"), | ||
], | ||
) | ||
def test_user_update_schema_accepts_valid_attribute_pairs(user_attribute, user_value): | ||
|
Oops, something went wrong.