mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
Even more format strings changed.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -35,7 +35,7 @@ def test_create_notification_should_reject_if_missing_required_fields(
|
|||||||
with notify_api.test_request_context():
|
with notify_api.test_request_context():
|
||||||
with notify_api.test_client() as client:
|
with notify_api.test_client() as client:
|
||||||
mocked = mocker.patch(
|
mocked = mocker.patch(
|
||||||
"app.celery.provider_tasks.deliver_{}.apply_async".format(template_type)
|
f"app.celery.provider_tasks.deliver_{template_type}.apply_async"
|
||||||
)
|
)
|
||||||
data = {}
|
data = {}
|
||||||
auth_header = create_service_authorization_header(
|
auth_header = create_service_authorization_header(
|
||||||
@@ -43,7 +43,7 @@ def test_create_notification_should_reject_if_missing_required_fields(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(template_type),
|
path=f"/notifications/{template_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[("Content-Type", "application/json"), auth_header],
|
headers=[("Content-Type", "application/json"), auth_header],
|
||||||
)
|
)
|
||||||
@@ -286,7 +286,7 @@ def test_should_not_send_notification_if_restricted_and_not_a_service_user(
|
|||||||
with notify_api.test_request_context():
|
with notify_api.test_request_context():
|
||||||
with notify_api.test_client() as client:
|
with notify_api.test_client() as client:
|
||||||
mocked = mocker.patch(
|
mocked = mocker.patch(
|
||||||
"app.celery.provider_tasks.deliver_{}.apply_async".format(template_type)
|
f"app.celery.provider_tasks.deliver_{template_type}.apply_async"
|
||||||
)
|
)
|
||||||
template = (
|
template = (
|
||||||
sample_template
|
sample_template
|
||||||
@@ -302,7 +302,7 @@ def test_should_not_send_notification_if_restricted_and_not_a_service_user(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(template_type),
|
path=f"/notifications/{template_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[("Content-Type", "application/json"), auth_header],
|
headers=[("Content-Type", "application/json"), auth_header],
|
||||||
)
|
)
|
||||||
@@ -326,7 +326,7 @@ def test_should_send_notification_if_restricted_and_a_service_user(
|
|||||||
with notify_api.test_request_context():
|
with notify_api.test_request_context():
|
||||||
with notify_api.test_client() as client:
|
with notify_api.test_client() as client:
|
||||||
mocked = mocker.patch(
|
mocked = mocker.patch(
|
||||||
"app.celery.provider_tasks.deliver_{}.apply_async".format(template_type)
|
f"app.celery.provider_tasks.deliver_{template_type}.apply_async"
|
||||||
)
|
)
|
||||||
|
|
||||||
template = (
|
template = (
|
||||||
@@ -348,7 +348,7 @@ def test_should_send_notification_if_restricted_and_a_service_user(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(template_type),
|
path=f"/notifications/{template_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[("Content-Type", "application/json"), auth_header],
|
headers=[("Content-Type", "application/json"), auth_header],
|
||||||
)
|
)
|
||||||
@@ -364,7 +364,7 @@ def test_should_not_allow_template_from_another_service(
|
|||||||
with notify_api.test_request_context():
|
with notify_api.test_request_context():
|
||||||
with notify_api.test_client() as client:
|
with notify_api.test_client() as client:
|
||||||
mocked = mocker.patch(
|
mocked = mocker.patch(
|
||||||
"app.celery.provider_tasks.deliver_{}.apply_async".format(template_type)
|
f"app.celery.provider_tasks.deliver_{template_type}.apply_async"
|
||||||
)
|
)
|
||||||
service_1 = service_factory.get(
|
service_1 = service_factory.get(
|
||||||
"service 1", user=sample_user, email_from="service.1"
|
"service 1", user=sample_user, email_from="service.1"
|
||||||
@@ -386,7 +386,7 @@ def test_should_not_allow_template_from_another_service(
|
|||||||
auth_header = create_service_authorization_header(service_id=service_1.id)
|
auth_header = create_service_authorization_header(service_id=service_1.id)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(template_type),
|
path=f"/notifications/{template_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[("Content-Type", "application/json"), auth_header],
|
headers=[("Content-Type", "application/json"), auth_header],
|
||||||
)
|
)
|
||||||
@@ -729,7 +729,7 @@ def test_should_send_sms_if_team_api_key_and_a_service_user(
|
|||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[
|
headers=[
|
||||||
("Content-Type", "application/json"),
|
("Content-Type", "application/json"),
|
||||||
("Authorization", "Bearer {}".format(auth_header)),
|
("Authorization", f"Bearer {auth_header}"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -783,11 +783,11 @@ def test_should_persist_notification(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(template_type),
|
path=f"/notifications/{template_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[
|
headers=[
|
||||||
("Content-Type", "application/json"),
|
("Content-Type", "application/json"),
|
||||||
("Authorization", "Bearer {}".format(auth_header)),
|
("Authorization", f"Bearer {auth_header}"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ def test_should_delete_notification_and_return_error_if_redis_fails(
|
|||||||
queue_name,
|
queue_name,
|
||||||
):
|
):
|
||||||
mocked = mocker.patch(
|
mocked = mocker.patch(
|
||||||
"app.celery.provider_tasks.deliver_{}.apply_async".format(template_type),
|
f"app.celery.provider_tasks.deliver_{template_type}.apply_async",
|
||||||
side_effect=Exception("failed to talk to redis"),
|
side_effect=Exception("failed to talk to redis"),
|
||||||
)
|
)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
@@ -1012,7 +1012,7 @@ def test_should_send_notification_to_guest_list_recipient(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
path="/notifications/{}".format(notification_type),
|
path=f"/notifications/{notification_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[
|
headers=[
|
||||||
("Content-Type", "application/json"),
|
("Content-Type", "application/json"),
|
||||||
@@ -1042,7 +1042,7 @@ def test_should_error_if_notification_type_does_not_match_template_type(
|
|||||||
data = {"to": to, "template": template.id}
|
data = {"to": to, "template": template.id}
|
||||||
auth_header = create_service_authorization_header(service_id=template.service_id)
|
auth_header = create_service_authorization_header(service_id=template.service_id)
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/notifications/{}".format(notification_type),
|
f"/notifications/{notification_type}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
headers=[("Content-Type", "application/json"), auth_header],
|
headers=[("Content-Type", "application/json"), auth_header],
|
||||||
)
|
)
|
||||||
@@ -1051,9 +1051,7 @@ def test_should_error_if_notification_type_does_not_match_template_type(
|
|||||||
json_resp = json.loads(response.get_data(as_text=True))
|
json_resp = json.loads(response.get_data(as_text=True))
|
||||||
assert json_resp["result"] == "error"
|
assert json_resp["result"] == "error"
|
||||||
assert (
|
assert (
|
||||||
"{0} template is not suitable for {1} notification".format(
|
f"{template_type} template is not suitable for {notification_type} notification"
|
||||||
template_type, notification_type
|
|
||||||
)
|
|
||||||
in json_resp["message"]
|
in json_resp["message"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1111,9 +1109,7 @@ def test_create_template_raises_invalid_request_when_content_too_large(
|
|||||||
pytest.fail("do not expect an InvalidRequest")
|
pytest.fail("do not expect an InvalidRequest")
|
||||||
assert e.message == {
|
assert e.message == {
|
||||||
"content": [
|
"content": [
|
||||||
"Content has a character count greater than the limit of {}".format(
|
f"Content has a character count greater than the limit of {SMS_CHAR_COUNT_LIMIT}"
|
||||||
SMS_CHAR_COUNT_LIMIT
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user