mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Parametrize template create
Cleaner than having two almost identical tests.
This commit is contained in:
@@ -10,14 +10,20 @@ from app.models import Template, TemplateHistory
|
||||
import pytest
|
||||
|
||||
|
||||
def test_create_template(sample_service, sample_user):
|
||||
@pytest.mark.parametrize('template_type, subject', [
|
||||
('sms', None),
|
||||
('email', 'subject'),
|
||||
])
|
||||
def test_create_template(sample_service, sample_user, template_type, subject):
|
||||
data = {
|
||||
'name': 'Sample Template',
|
||||
'template_type': "sms",
|
||||
'template_type': template_type,
|
||||
'content': "Template content",
|
||||
'service': sample_service,
|
||||
'created_by': sample_user
|
||||
}
|
||||
if subject:
|
||||
data.update({'subject': subject})
|
||||
template = Template(**data)
|
||||
dao_create_template(template)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user