mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Fix for create job id on api side
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import uuid
|
||||
|
||||
from app.models import Notification
|
||||
|
||||
from app.dao.notifications_dao import (
|
||||
@@ -12,11 +10,8 @@ from app.dao.notifications_dao import (
|
||||
def test_save_notification(notify_db, notify_db_session, sample_template, sample_job):
|
||||
|
||||
assert Notification.query.count() == 0
|
||||
|
||||
notification_id = uuid.uuid4()
|
||||
to = '+44709123456'
|
||||
data = {
|
||||
'id': notification_id,
|
||||
'to': to,
|
||||
'job': sample_job,
|
||||
'service': sample_template.service,
|
||||
@@ -27,10 +22,8 @@ def test_save_notification(notify_db, notify_db_session, sample_template, sample
|
||||
save_notification(notification)
|
||||
|
||||
assert Notification.query.count() == 1
|
||||
|
||||
notification_from_db = Notification.query.get(notification_id)
|
||||
|
||||
assert data['id'] == notification_from_db.id
|
||||
notification_from_db = Notification.query.all()[0]
|
||||
assert notification_from_db.id
|
||||
assert data['to'] == notification_from_db.to
|
||||
assert data['job'] == notification_from_db.job
|
||||
assert data['service'] == notification_from_db.service
|
||||
|
||||
@@ -219,10 +219,8 @@ def test_get_notifications(notify_api, notify_db, notify_db_session, sample_job)
|
||||
|
||||
def test_add_notification(notify_api, notify_db, notify_db_session, sample_job):
|
||||
|
||||
notificaton_id = uuid.uuid4()
|
||||
to = '+44709123456'
|
||||
data = {
|
||||
'id': str(notificaton_id),
|
||||
'to': to,
|
||||
'job': str(sample_job.id),
|
||||
'service': str(sample_job.service.id),
|
||||
@@ -245,7 +243,7 @@ def test_add_notification(notify_api, notify_db, notify_db_session, sample_job):
|
||||
|
||||
resp_json = json.loads(response.get_data(as_text=True))
|
||||
|
||||
assert data['id'] == resp_json['data']['id']
|
||||
assert resp_json['data']['id']
|
||||
assert data['to'] == resp_json['data']['to']
|
||||
assert data['service'] == resp_json['data']['service']
|
||||
assert data['template'] == resp_json['data']['template']
|
||||
|
||||
Reference in New Issue
Block a user