Update utils to 12.0.0

Includes:

- [x] https://github.com/alphagov/notifications-utils/pull/94 (breaking
      changes which are responsible for all the changes to the API in
      this PR)

The test for `get_sms_fragment_count` has been removed because this
method is already tested in utils here:

ac20f7e99e/tests/test_base_template.py (L140-L159)
This commit is contained in:
Chris Hill-Scott
2016-12-09 15:56:25 +00:00
parent 4f9b295a5b
commit 59af44d7ab
14 changed files with 70 additions and 99 deletions

View File

@@ -1,4 +1,6 @@
from flask import url_for
from app.models import SMS_TYPE, EMAIL_TYPE
from notifications_utils.template import SMSMessageTemplate, PlainTextEmailTemplate
def pagination_links(pagination, endpoint, **kwargs):
@@ -18,3 +20,9 @@ def url_with_token(data, url, config):
token = generate_token(data, config['SECRET_KEY'], config['DANGEROUS_SALT'])
base_url = config['ADMIN_BASE_URL'] + url
return base_url + token
def get_template_instance(template, values):
return {
SMS_TYPE: SMSMessageTemplate, EMAIL_TYPE: PlainTextEmailTemplate
}[template['template_type']](template, values)