Merge branch 'main' of https://github.com/GSA/notifications-api into notify-260

This commit is contained in:
Kenneth Kehl
2023-05-30 11:47:36 -07:00
38 changed files with 305 additions and 544 deletions

View File

@@ -169,12 +169,6 @@ def test_send_notification_with_placeholders_replaced(notify_api, sample_email_t
),
'6',
),
pytest.param(
None,
('we consider None equivalent to missing personalisation'),
'',
marks=pytest.mark.xfail
),
])
def test_send_notification_with_placeholders_replaced_with_unusual_types(
client,
@@ -209,6 +203,43 @@ def test_send_notification_with_placeholders_replaced_with_unusual_types(
assert response_data['subject'] == expected_subject
@pytest.mark.parametrize('personalisation, expected_body, expected_subject', [
(
None,
('we consider None equivalent to missing personalisation'),
'',
),
])
def test_send_notification_with_placeholders_replaced_with_unusual_types_no_personalization(
client,
sample_email_template_with_placeholders,
mocker,
personalisation,
expected_body,
expected_subject,
):
mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
response = client.post(
path='/notifications/email',
data=json.dumps(
{
'to': 'ok@ok.com',
'template': str(sample_email_template_with_placeholders.id),
'personalisation': {
'name': personalisation
}
}
),
headers=[
('Content-Type', 'application/json'),
create_service_authorization_header(service_id=sample_email_template_with_placeholders.service.id)
]
)
assert response.status_code == 400
def test_should_not_send_notification_for_archived_template(notify_api, sample_template):
with notify_api.test_request_context():
with notify_api.test_client() as client:

View File

@@ -1944,7 +1944,6 @@ def test_get_detailed_service(sample_template, client, sample_service, today_onl
assert service['statistics'][SMS_TYPE] == stats
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_get_services_with_detailed_flag(client, sample_template):
notifications = [
create_notification(sample_template),
@@ -1967,7 +1966,6 @@ def test_get_services_with_detailed_flag(client, sample_template):
}
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_get_services_with_detailed_flag_excluding_from_test_key(client, sample_template):
create_notification(sample_template, key_type=KEY_TYPE_NORMAL)
create_notification(sample_template, key_type=KEY_TYPE_TEAM)
@@ -2023,7 +2021,6 @@ def test_get_services_with_detailed_flag_defaults_to_today(client, mocker):
assert resp.status_code == 200
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_get_detailed_services_groups_by_service(notify_db_session):
from app.service.rest import get_detailed_services
@@ -2054,7 +2051,6 @@ def test_get_detailed_services_groups_by_service(notify_db_session):
}
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_get_detailed_services_includes_services_with_no_notifications(notify_db_session):
from app.service.rest import get_detailed_services