Use notify to send email verification

This commit is contained in:
Rebecca Law
2016-06-09 16:41:20 +01:00
parent b677768de1
commit cfd31541f4
3 changed files with 90 additions and 14 deletions

View File

@@ -589,3 +589,37 @@ def sms_code_template(notify_db,
template = Template(**data)
db.session.add(template)
return template
@pytest.fixture(scope='function')
def email_verification_template(notify_db,
notify_db_session):
user = sample_user(notify_db, notify_db_session)
service = Service.query.get(current_app.config['NOTIFY_SERVICE_ID'])
if not service:
data = {
'id': current_app.config['NOTIFY_SERVICE_ID'],
'name': 'Notify Service',
'message_limit': 1000,
'active': True,
'restricted': False,
'email_from': 'notify.service',
'created_by': user
}
service = Service(**data)
db.session.add(service)
template = Template.query.get(current_app.config['SMS_CODE_TEMPLATE_ID'])
if not template:
data = {
'id': current_app.config['EMAIL_VERIFY_CODE_TEMPLATE_ID'],
'name': 'Email verification template',
'template_type': 'email',
'content': '((user_name)) use ((url)) to complete registration',
'service': service,
'created_by': user,
'archived': False
}
template = Template(**data)
db.session.add(template)
return template