mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
infer template/service from job for notification/ft_noti_status in db.py
This commit is contained in:
@@ -1101,7 +1101,9 @@ def restore_provider_details(notify_db, notify_db_session):
|
||||
|
||||
@pytest.fixture
|
||||
def admin_request(client):
|
||||
|
||||
class AdminRequest:
|
||||
app = client.application
|
||||
|
||||
@staticmethod
|
||||
def get(endpoint, _expected_status=200, **endpoint_kwargs):
|
||||
|
||||
@@ -164,7 +164,7 @@ def create_template(
|
||||
|
||||
|
||||
def create_notification(
|
||||
template,
|
||||
template=None,
|
||||
job=None,
|
||||
job_row_number=None,
|
||||
to_field=None,
|
||||
@@ -190,6 +190,10 @@ def create_notification(
|
||||
created_by_id=None,
|
||||
postage=None
|
||||
):
|
||||
assert job or template
|
||||
if job:
|
||||
template = job.template
|
||||
|
||||
if created_at is None:
|
||||
created_at = datetime.utcnow()
|
||||
|
||||
@@ -557,6 +561,8 @@ def create_ft_notification_status(
|
||||
notification_status='delivered',
|
||||
count=1
|
||||
):
|
||||
if job:
|
||||
template = job.template
|
||||
if template:
|
||||
service = template.service
|
||||
notification_type = template.template_type
|
||||
|
||||
Reference in New Issue
Block a user