add created_by to notifications

this is so one-off notifications can be tied to a user
(jobs have a created_by, and api notifications don't make sense
 to have one)
This commit is contained in:
Leo Hemsted
2017-06-13 15:33:33 +01:00
parent 8a49afc06c
commit 9f307fd1c5
4 changed files with 50 additions and 0 deletions

View File

@@ -1316,6 +1316,25 @@ def test_get_notification_for_service(client, notify_db, notify_db_session):
assert service_2_response == {'message': 'No result found', 'result': 'error'}
def test_get_notification_for_service_includes_created_by(admin_request, sample_notification):
user = sample_notification.created_by = sample_notification.service.created_by
resp = admin_request.get(
'service.get_notification_for_service',
endpoint_kwargs={
'service_id': sample_notification.service_id,
'notification_id': sample_notification.id
}
)
assert resp['id'] == str(sample_notification.id)
assert resp['created_by'] == {
'id': str(user.id),
'name': user.name,
'email_address': user.email_address
}
@pytest.mark.parametrize(
'include_from_test_key, expected_count_of_notifications',
[