mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Remove all methods no longer used now that we only send pdf files to DVLA.
This commit is contained in:
@@ -45,7 +45,6 @@ from app.dao.provider_details_dao import (
|
||||
dao_update_provider_details,
|
||||
get_current_provider
|
||||
)
|
||||
from app.dao.service_permissions_dao import dao_add_service_permission
|
||||
from app.models import (
|
||||
MonthlyBilling,
|
||||
NotificationHistory,
|
||||
@@ -803,8 +802,6 @@ def test_run_letter_jobs(client, mocker, sample_letter_template):
|
||||
|
||||
@freeze_time("2017-12-18 17:50")
|
||||
def test_trigger_letter_pdfs_for_day(client, mocker, sample_letter_template):
|
||||
dao_add_service_permission(sample_letter_template.service.id, 'letters_as_pdf')
|
||||
|
||||
create_notification(template=sample_letter_template, created_at='2017-12-17 17:30:00')
|
||||
create_notification(template=sample_letter_template, created_at='2017-12-18 17:29:59')
|
||||
|
||||
@@ -820,8 +817,6 @@ def test_trigger_letter_pdfs_for_day(client, mocker, sample_letter_template):
|
||||
@freeze_time("2017-12-18 17:50")
|
||||
def test_trigger_letter_pdfs_for_day_send_task_not_called_if_no_notis_for_day(
|
||||
client, mocker, sample_letter_template):
|
||||
dao_add_service_permission(sample_letter_template.service.id, 'letters_as_pdf')
|
||||
|
||||
create_notification(template=sample_letter_template, created_at='2017-12-15 17:30:00')
|
||||
|
||||
mock_celery = mocker.patch("app.celery.tasks.notify_celery.send_task")
|
||||
|
||||
@@ -198,7 +198,7 @@ def sample_service_full_permissions(notify_db, notify_db_session):
|
||||
notify_db_session,
|
||||
# ensure name doesn't clash with regular sample service
|
||||
service_name="sample service full permissions",
|
||||
permissions=set(SERVICE_PERMISSION_TYPES) - {'letters_as_pdf'}
|
||||
permissions=set(SERVICE_PERMISSION_TYPES)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
from app.models import (
|
||||
Notification,
|
||||
NOTIFICATION_CREATED,
|
||||
NOTIFICATION_PENDING,
|
||||
NOTIFICATION_SENDING,
|
||||
KEY_TYPE_TEST,
|
||||
KEY_TYPE_NORMAL,
|
||||
LETTER_TYPE
|
||||
)
|
||||
from app.dao.notifications_dao import dao_set_created_live_letter_api_notifications_to_pending
|
||||
|
||||
from tests.app.db import create_notification, create_service, create_template
|
||||
|
||||
|
||||
def test_should_only_get_letter_notifications(
|
||||
sample_letter_notification,
|
||||
sample_email_notification,
|
||||
sample_notification
|
||||
):
|
||||
ret = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
assert sample_letter_notification.status == NOTIFICATION_PENDING
|
||||
assert sample_email_notification.status == NOTIFICATION_CREATED
|
||||
assert sample_notification.status == NOTIFICATION_CREATED
|
||||
assert ret == [sample_letter_notification]
|
||||
|
||||
|
||||
def test_should_ignore_letters_as_pdf(sample_letter_notification):
|
||||
service = create_service(service_permissions=[LETTER_TYPE, 'letters_as_pdf'])
|
||||
template = create_template(service, template_type=LETTER_TYPE)
|
||||
create_notification(template)
|
||||
|
||||
all_noti = Notification.query.all()
|
||||
assert len(all_noti) == 2
|
||||
|
||||
ret = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
assert sample_letter_notification.status == NOTIFICATION_PENDING
|
||||
assert ret == [sample_letter_notification]
|
||||
|
||||
|
||||
def test_should_only_get_created_letters(sample_letter_template):
|
||||
created_noti = create_notification(sample_letter_template, status=NOTIFICATION_CREATED)
|
||||
create_notification(sample_letter_template, status=NOTIFICATION_PENDING)
|
||||
create_notification(sample_letter_template, status=NOTIFICATION_SENDING)
|
||||
|
||||
ret = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
assert ret == [created_noti]
|
||||
|
||||
|
||||
def test_should_only_get_api_letters(sample_letter_template, sample_letter_job):
|
||||
api_noti = create_notification(sample_letter_template)
|
||||
create_notification(sample_letter_template, job=sample_letter_job)
|
||||
|
||||
ret = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
assert ret == [api_noti]
|
||||
|
||||
|
||||
def test_should_only_get_normal_api_letters(sample_letter_template):
|
||||
live_noti = create_notification(sample_letter_template, key_type=KEY_TYPE_NORMAL)
|
||||
create_notification(sample_letter_template, key_type=KEY_TYPE_TEST)
|
||||
|
||||
ret = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
assert ret == [live_noti]
|
||||
@@ -13,9 +13,7 @@ from app.dao.jobs_dao import (
|
||||
dao_set_scheduled_jobs_to_pending,
|
||||
dao_get_future_scheduled_job_by_id_and_service_id,
|
||||
dao_get_notification_outcomes_for_job,
|
||||
all_notifications_are_created_for_job,
|
||||
dao_update_job_status,
|
||||
dao_get_all_notifications_for_job,
|
||||
dao_get_jobs_older_than_limited_by,
|
||||
dao_get_job_statistics_for_job,
|
||||
dao_get_job_stats_for_service,
|
||||
@@ -372,33 +370,6 @@ def test_get_jobs_for_service_doesnt_return_test_messages(
|
||||
assert jobs == [sample_job]
|
||||
|
||||
|
||||
def test_all_notifications_are_created_for_job_returns_true(notify_db, notify_db_session):
|
||||
job = create_job(notify_db=notify_db, notify_db_session=notify_db_session, notification_count=2)
|
||||
create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=job)
|
||||
create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=job)
|
||||
job_is_complete = all_notifications_are_created_for_job(job.id)
|
||||
assert job_is_complete
|
||||
|
||||
|
||||
def test_all_notifications_are_created_for_job_returns_false(notify_db, notify_db_session):
|
||||
job = create_job(notify_db=notify_db, notify_db_session=notify_db_session, notification_count=2)
|
||||
job_is_complete = all_notifications_are_created_for_job(job.id)
|
||||
assert not job_is_complete
|
||||
|
||||
|
||||
def test_are_all_notifications_created_for_job_returns_false_when_job_does_not_exist():
|
||||
job_is_complete = all_notifications_are_created_for_job(uuid.uuid4())
|
||||
assert not job_is_complete
|
||||
|
||||
|
||||
def test_dao_get_all_notifications_for_job(notify_db, notify_db_session, sample_job):
|
||||
create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=sample_job)
|
||||
create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=sample_job)
|
||||
create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=sample_job)
|
||||
|
||||
assert len(dao_get_all_notifications_for_job(sample_job.id)) == 3
|
||||
|
||||
|
||||
def test_dao_update_job_status(sample_job):
|
||||
dao_update_job_status(sample_job.id, 'sent to dvla')
|
||||
updated_job = Job.query.get(sample_job.id)
|
||||
|
||||
Reference in New Issue
Block a user