mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Remove unused functions
Can't see these being used anywhere so lets get rid of them
This commit is contained in:
@@ -179,10 +179,6 @@ def dao_update_notification(notification):
|
|||||||
db.session.add(notification)
|
db.session.add(notification)
|
||||||
|
|
||||||
|
|
||||||
def get_notification_for_job(service_id, job_id, notification_id):
|
|
||||||
return Notification.query.filter_by(service_id=service_id, job_id=job_id, id=notification_id).one()
|
|
||||||
|
|
||||||
|
|
||||||
def get_notifications_for_job(service_id, job_id, filter_dict=None, page=1, page_size=None):
|
def get_notifications_for_job(service_id, job_id, filter_dict=None, page=1, page_size=None):
|
||||||
if page_size is None:
|
if page_size is None:
|
||||||
page_size = current_app.config['PAGE_SIZE']
|
page_size = current_app.config['PAGE_SIZE']
|
||||||
@@ -217,10 +213,6 @@ def get_notification_by_id(notification_id, service_id=None, _raise=False):
|
|||||||
return query.one() if _raise else query.first()
|
return query.one() if _raise else query.first()
|
||||||
|
|
||||||
|
|
||||||
def get_notifications(filter_dict=None):
|
|
||||||
return _filter_query(Notification.query, filter_dict=filter_dict)
|
|
||||||
|
|
||||||
|
|
||||||
def get_notifications_for_service(
|
def get_notifications_for_service(
|
||||||
service_id,
|
service_id,
|
||||||
filter_dict=None,
|
filter_dict=None,
|
||||||
@@ -626,12 +618,6 @@ def dao_get_notification_or_history_by_reference(reference):
|
|||||||
).one()
|
).one()
|
||||||
|
|
||||||
|
|
||||||
def dao_get_notifications_by_references(references):
|
|
||||||
return Notification.query.filter(
|
|
||||||
Notification.reference.in_(references)
|
|
||||||
).all()
|
|
||||||
|
|
||||||
|
|
||||||
def dao_get_notifications_processing_time_stats(start_date, end_date):
|
def dao_get_notifications_processing_time_stats(start_date, end_date):
|
||||||
"""
|
"""
|
||||||
For a given time range, returns the number of notifications sent and the number of
|
For a given time range, returns the number of notifications sent and the number of
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ from app.celery.letters_pdf_tasks import (
|
|||||||
update_validation_failed_for_templated_letter,
|
update_validation_failed_for_templated_letter,
|
||||||
)
|
)
|
||||||
from app.config import QueueNames, TaskNames
|
from app.config import QueueNames, TaskNames
|
||||||
from app.dao.notifications_dao import get_notifications
|
|
||||||
from app.errors import VirusScanError
|
from app.errors import VirusScanError
|
||||||
from app.exceptions import NotificationTechnicalFailureException
|
from app.exceptions import NotificationTechnicalFailureException
|
||||||
from app.letters.utils import ScanErrorType
|
from app.letters.utils import ScanErrorType
|
||||||
@@ -515,7 +514,7 @@ def test_send_letters_volume_email_to_dvla(notify_api, notify_db_session, mocker
|
|||||||
|
|
||||||
send_letters_volume_email_to_dvla(letters_volumes, datetime(2020, 2, 17).date())
|
send_letters_volume_email_to_dvla(letters_volumes, datetime(2020, 2, 17).date())
|
||||||
|
|
||||||
emails_to_dvla = get_notifications().all()
|
emails_to_dvla = Notification.query.all()
|
||||||
assert len(emails_to_dvla) == 2
|
assert len(emails_to_dvla) == 2
|
||||||
send_mock.called = 2
|
send_mock.called = 2
|
||||||
send_mock.assert_any_call([str(emails_to_dvla[0].id)], queue=QueueNames.NOTIFY)
|
send_mock.assert_any_call([str(emails_to_dvla[0].id)], queue=QueueNames.NOTIFY)
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ from app.dao.notifications_dao import (
|
|||||||
dao_get_notification_count_for_job_id,
|
dao_get_notification_count_for_job_id,
|
||||||
dao_get_notification_or_history_by_reference,
|
dao_get_notification_or_history_by_reference,
|
||||||
dao_get_notifications_by_recipient_or_reference,
|
dao_get_notifications_by_recipient_or_reference,
|
||||||
dao_get_notifications_by_references,
|
|
||||||
dao_timeout_notifications,
|
dao_timeout_notifications,
|
||||||
dao_update_notification,
|
dao_update_notification,
|
||||||
dao_update_notifications_by_reference,
|
dao_update_notifications_by_reference,
|
||||||
get_notification_by_id,
|
get_notification_by_id,
|
||||||
get_notification_for_job,
|
|
||||||
get_notification_with_personalisation,
|
get_notification_with_personalisation,
|
||||||
get_notifications_for_job,
|
get_notifications_for_job,
|
||||||
get_notifications_for_service,
|
get_notifications_for_service,
|
||||||
@@ -503,14 +501,6 @@ def test_save_notification_no_job_id(sample_template):
|
|||||||
assert data.get('job_id') is None
|
assert data.get('job_id') is None
|
||||||
|
|
||||||
|
|
||||||
def test_get_notification_for_job(sample_notification):
|
|
||||||
notification_from_db = get_notification_for_job(
|
|
||||||
sample_notification.service.id,
|
|
||||||
sample_notification.job_id,
|
|
||||||
sample_notification.id)
|
|
||||||
assert sample_notification == notification_from_db
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_all_notifications_for_job(sample_job):
|
def test_get_all_notifications_for_job(sample_job):
|
||||||
for _ in range(0, 5):
|
for _ in range(0, 5):
|
||||||
try:
|
try:
|
||||||
@@ -1602,17 +1592,6 @@ def test_dao_get_notification_by_reference_with_no_matches_raises_error(notify_d
|
|||||||
dao_get_notification_by_reference('REF1')
|
dao_get_notification_by_reference('REF1')
|
||||||
|
|
||||||
|
|
||||||
def test_dao_get_notifications_by_references(sample_template):
|
|
||||||
create_notification(template=sample_template, reference='noref')
|
|
||||||
notification_1 = create_notification(template=sample_template, reference='ref')
|
|
||||||
notification_2 = create_notification(template=sample_template, reference='ref')
|
|
||||||
|
|
||||||
notifications = dao_get_notifications_by_references(['ref'])
|
|
||||||
assert len(notifications) == 2
|
|
||||||
assert notifications[0].id in [notification_1.id, notification_2.id]
|
|
||||||
assert notifications[1].id in [notification_1.id, notification_2.id]
|
|
||||||
|
|
||||||
|
|
||||||
def test_dao_get_notification_or_history_by_reference_with_one_match_returns_notification(
|
def test_dao_get_notification_or_history_by_reference_with_one_match_returns_notification(
|
||||||
sample_letter_template
|
sample_letter_template
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user