Merge pull request #287 from alphagov/notification_history_page

Notification history page
This commit is contained in:
minglis
2016-03-18 14:32:55 +00:00
14 changed files with 428 additions and 23 deletions

View File

@@ -167,7 +167,7 @@ def mock_get_service_statistics(mocker):
def mock_get_service_template(mocker):
def _create(service_id, template_id):
template = template_json(
template_id, "Two week reminder", "sms", "Your vehicle tax is about to expire", service_id)
service_id, template_id, "Two week reminder", "sms", "Your vehicle tax is about to expire")
return {'data': template}
return mocker.patch(
@@ -178,7 +178,7 @@ def mock_get_service_template(mocker):
def mock_get_service_email_template(mocker):
def _create(service_id, template_id):
template = template_json(
template_id, "Two week reminder", "email", "Your vehicle tax is about to expire", service_id)
service_id, template_id, "Two week reminder", "email", "Your vehicle tax is about to expire")
return {'data': template}
return mocker.patch(
@@ -189,7 +189,7 @@ def mock_get_service_email_template(mocker):
def mock_create_service_template(mocker):
def _create(name, type_, content, service):
template = template_json(
101, name, type_, content, service)
service, 101, name, type_, content)
return {'data': template}
return mocker.patch(
@@ -201,7 +201,7 @@ def mock_create_service_template(mocker):
def mock_update_service_template(mocker):
def _update(id_, name, type_, content, service):
template = template_json(
id_, name, type_, content, service)
service, id_, name, type_, content)
return {'data': template}
return mocker.patch(
@@ -214,17 +214,13 @@ def mock_get_service_templates(mocker):
def _create(service_id):
return {'data': [
template_json(
1, "sms_template_one", "sms", "sms template one content", service_id
),
service_id, 1, "sms_template_one", "sms", "sms template one content"),
template_json(
2, "sms_template_two", "sms", "sms template two content", service_id
),
service_id, 2, "sms_template_two", "sms", "sms template two content"),
template_json(
3, "email_template_one", "email", "email template one content", service_id
),
service_id, 3, "email_template_one", "email", "email template one content"),
template_json(
4, "email_template_two", "email", "email template two content", service_id
)
service_id, 4, "email_template_two", "email", "email template two content")
]}
return mocker.patch(
@@ -236,8 +232,7 @@ def mock_get_service_templates(mocker):
def mock_delete_service_template(mocker):
def _delete(service_id, template_id):
template = template_json(
template_id, "Template to delete",
"sms", "content to be deleted", service_id)
service_id, template_id, "Template to delete", "sms", "content to be deleted")
return {'data': template}
return mocker.patch(
@@ -599,8 +594,18 @@ def mock_get_jobs(mocker):
@pytest.fixture(scope='function')
def mock_get_notifications(mocker):
def _get_notifications(service_id, job_id):
return notification_json()
def _get_notifications(service_id, job_id=None, page=1):
return notification_json(service_id)
return mocker.patch(
'app.notification_api_client.get_notifications_for_service',
side_effect=_get_notifications
)
@pytest.fixture(scope='function')
def mock_get_notifications_with_previous_next(mocker):
def _get_notifications(service_id, job_id=None, page=1):
return notification_json(service_id, with_links=True)
return mocker.patch(
'app.notification_api_client.get_notifications_for_service',
side_effect=_get_notifications