Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 12.2.0

* Document `personalisation` on template responses from `get_template`, `get_template_version` and `get_all_templates`. This is an object of placeholder names, for example `{"name": {"required": True}}`.

## 12.1.0

* Adds `sanitise_content_for` parameter to `send_email_notification` endpoint. See [our documentation](https://docs.notifications.service.gov.uk/python.html#reducing-the-risk-of-malicious-content-injection-in-placeholders) for guidance on how to use this.
Expand Down
7 changes: 7 additions & 0 deletions integration_test/schemas/v2/template_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
"body": {"type": "string"},
"subject": {"type": ["string", "null"]},
"letter_contact_block": {"type": ["string", "null"]},
"personalisation": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {"required": {"type": "boolean"}},
},
},
},
"required": ["id", "type", "created_at", "updated_at", "version", "created_by", "body"],
}
Expand Down
2 changes: 1 addition & 1 deletion notifications_python_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# -- http://semver.org/

__version__ = "12.1.0"
__version__ = "12.2.0"

from notifications_python_client.errors import ( # noqa
REQUEST_ERROR_MESSAGE,
Expand Down
14 changes: 14 additions & 0 deletions tests/notifications_python_client/test_notifications_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,20 @@ def test_get_template(notifications_client, rmock):
assert rmock.called


def test_get_template_returns_personalisation(notifications_client, rmock):
endpoint = f"{TEST_HOST}/v2/template/{123}"
rmock.request(
"GET",
endpoint,
json={"id": "123", "personalisation": {"name": {"required": True}}},
status_code=200,
)

response = notifications_client.get_template(123)

assert response["personalisation"] == {"name": {"required": True}}


def test_get_template_version(notifications_client, rmock):
endpoint = f"{TEST_HOST}/v2/template/123/version/1"
rmock.request("GET", endpoint, json={"status": "success"}, status_code=200)
Expand Down
Loading