Further refactoring

This commit is contained in:
Ken Tsang
2017-06-30 15:00:44 +01:00
committed by venusbb
parent 0b3277b8a4
commit 23618a186c
5 changed files with 27 additions and 30 deletions

View File

@@ -91,9 +91,9 @@ def test_should_raise_error_if_service_does_not_exist_on_create(client, sample_u
@pytest.mark.parametrize('permissions, template_type, subject, expected_error', [
([EMAIL_TYPE], SMS_TYPE, None, 'Creating text message templates is not allowed'),
([SMS_TYPE], EMAIL_TYPE, 'subject', 'Creating email templates is not allowed'),
([SMS_TYPE], LETTER_TYPE, 'subject', 'Creating letter templates is not allowed'),
([EMAIL_TYPE], SMS_TYPE, None, {'template_type': ['Creating text message templates is not allowed']}),
([SMS_TYPE], EMAIL_TYPE, 'subject', {'template_type': ['Creating email templates is not allowed']}),
([SMS_TYPE], LETTER_TYPE, 'subject', {'template_type': ['Creating letter templates is not allowed']}),
])
def test_should_raise_error_on_create_if_no_permission(
client, sample_user, permissions, template_type, subject, expected_error):
@@ -123,9 +123,9 @@ def test_should_raise_error_on_create_if_no_permission(
@pytest.mark.parametrize('template_factory, expected_error', [
(sample_template_without_sms_permission, 'Updating text message templates is not allowed'),
(sample_template_without_email_permission, 'Updating email templates is not allowed'),
(sample_template_without_letter_permission, 'Updating letter templates is not allowed')
(sample_template_without_sms_permission, {'template_type': ['Updating text message templates is not allowed']}),
(sample_template_without_email_permission, {'template_type': ['Updating email templates is not allowed']}),
(sample_template_without_letter_permission, {'template_type': ['Updating letter templates is not allowed']})
])
def test_should_be_error_on_update_if_no_permission(
client, sample_user, template_factory, expected_error, notify_db, notify_db_session):