mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Create new column in notifications and notification_history to store the client_reference because I remembered that reference is used for email providers.
This commit is contained in:
@@ -64,7 +64,7 @@ def test_persist_notification_throws_exception_when_missing_template(sample_api_
|
||||
assert NotificationHistory.query.count() == 0
|
||||
|
||||
|
||||
def test_persist_notification_with_job_and_created(sample_job, sample_api_key):
|
||||
def test_persist_notification_with_optionals(sample_job, sample_api_key):
|
||||
assert Notification.query.count() == 0
|
||||
assert NotificationHistory.query.count() == 0
|
||||
created_at = datetime.datetime(2016, 11, 11, 16, 8, 18)
|
||||
@@ -77,13 +77,16 @@ def test_persist_notification_with_job_and_created(sample_job, sample_api_key):
|
||||
key_type=sample_api_key.key_type,
|
||||
created_at=created_at,
|
||||
job_id=sample_job.id,
|
||||
job_row_number=10)
|
||||
job_row_number=10,
|
||||
reference="ref from client")
|
||||
assert Notification.query.count() == 1
|
||||
assert NotificationHistory.query.count() == 1
|
||||
persisted_notification = Notification.query.all()[0]
|
||||
assert persisted_notification.job_id == sample_job.id
|
||||
assert persisted_notification.job_row_number == 10
|
||||
assert persisted_notification.created_at == created_at
|
||||
assert persisted_notification.client_reference == "ref from client"
|
||||
assert persisted_notification.reference is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('research_mode, queue, notification_type, key_type',
|
||||
|
||||
@@ -119,15 +119,14 @@ def test_post_email_notification_returns_201(client, sample_email_template, mock
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
assert response.status_code == 201
|
||||
resp_json = json.loads(response.get_data(as_text=True))
|
||||
notifications = Notification.query.all()
|
||||
assert len(notifications) == 1
|
||||
notification_id = notifications[0].id
|
||||
assert resp_json['id'] is not None
|
||||
notification = Notification.query.first()
|
||||
assert resp_json['id'] == str(notification.id)
|
||||
assert resp_json['reference'] == "reference from caller"
|
||||
assert notification.reference is None
|
||||
assert resp_json['content']['body'] == sample_email_template.content
|
||||
assert resp_json['content']['subject'] == sample_email_template.subject
|
||||
assert resp_json['content']['from_email'] == sample_email_template.service.email_from
|
||||
assert 'v2/notifications/{}'.format(notification_id) in resp_json['uri']
|
||||
assert 'v2/notifications/{}'.format(notification.id) in resp_json['uri']
|
||||
assert resp_json['template']['id'] == str(sample_email_template.id)
|
||||
assert resp_json['template']['version'] == sample_email_template.version
|
||||
assert 'v2/templates/{}'.format(sample_email_template.id) in resp_json['template']['uri']
|
||||
|
||||
Reference in New Issue
Block a user