fix tests

This commit is contained in:
Kenneth Kehl
2024-04-12 09:23:22 -07:00
parent 906609e4de
commit 0f3cdcf56a
14 changed files with 93 additions and 71 deletions

View File

@@ -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, "ok@ok.com"),
],
)
@@ -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, "not-someone-we-trust@email-address.com"),
],
)
@@ -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
):

View File

@@ -98,6 +98,7 @@ def test_send_one_off_notification_calls_persist_correctly_for_sms(
)
@pytest.mark.skip("We currently don't support international")
def test_send_one_off_notification_calls_persist_correctly_for_international_sms(
persist_mock, celery_mock, notify_db_session
):

View File

@@ -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="invited@digital.fake.gov",
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="invited@digital.fake.gov",
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="invited@digital.fake.gov",
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="invited@digital.fake.gov",
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="invited@digital.fake.gov",
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="invited@digital.fake.gov",
password="password",
mobile_number="+4477123456",
mobile_number="+14254147755",
)
save_model_user(user_to_add, validated_email_access=True)