mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
fix tests
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy import between, select
|
from sqlalchemy import between
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
|
|
||||||
from app import db, notify_celery, zendesk_client
|
from app import notify_celery, zendesk_client
|
||||||
from app.celery.tasks import (
|
from app.celery.tasks import (
|
||||||
get_recipient_csv_and_template_and_sender_id,
|
get_recipient_csv_and_template_and_sender_id,
|
||||||
process_incomplete_jobs,
|
process_incomplete_jobs,
|
||||||
@@ -105,28 +105,14 @@ def check_job_status():
|
|||||||
thirty_minutes_ago = utc_now() - timedelta(minutes=30)
|
thirty_minutes_ago = utc_now() - timedelta(minutes=30)
|
||||||
thirty_five_minutes_ago = utc_now() - timedelta(minutes=35)
|
thirty_five_minutes_ago = utc_now() - timedelta(minutes=35)
|
||||||
|
|
||||||
incomplete_in_progress_jobs = (
|
incomplete_in_progress_jobs = Job.query.filter(
|
||||||
db.session.execute(
|
Job.job_status == JobStatus.IN_PROGRESS,
|
||||||
select(Job).where(
|
between(Job.processing_started, thirty_five_minutes_ago, thirty_minutes_ago),
|
||||||
Job.job_status == JobStatus.IN_PROGRESS,
|
|
||||||
between(
|
|
||||||
Job.processing_started, thirty_five_minutes_ago, thirty_minutes_ago
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.scalars()
|
|
||||||
.all()
|
|
||||||
)
|
)
|
||||||
incomplete_pending_jobs = (
|
incomplete_pending_jobs = Job.query.filter(
|
||||||
db.session.execute(
|
Job.job_status == JobStatus.PENDING,
|
||||||
select(Job).where(
|
Job.scheduled_for.isnot(None),
|
||||||
Job.job_status == JobStatus.PENDING,
|
between(Job.scheduled_for, thirty_five_minutes_ago, thirty_minutes_ago),
|
||||||
Job.scheduled_for.isnot(None),
|
|
||||||
between(Job.scheduled_for, thirty_five_minutes_ago, thirty_minutes_ago),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.scalars()
|
|
||||||
.all()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
jobs_not_complete_after_30_minutes = (
|
jobs_not_complete_after_30_minutes = (
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ def test_save_service_inbound_api(sample_service):
|
|||||||
assert inbound_api.updated_at is None
|
assert inbound_api.updated_at is None
|
||||||
|
|
||||||
versioned = (
|
versioned = (
|
||||||
db.session.execute(select(ServiceInboundApi.get_history_model()))
|
db.session.execute(
|
||||||
.filter_by(id=inbound_api.id)
|
select(ServiceInboundApi.get_history_model()).filter_by(id=inbound_api.id)
|
||||||
|
)
|
||||||
.scalars()
|
.scalars()
|
||||||
.one()
|
.one()
|
||||||
)
|
)
|
||||||
@@ -94,9 +95,9 @@ def test_update_service_inbound_api(sample_service):
|
|||||||
|
|
||||||
versioned_results = (
|
versioned_results = (
|
||||||
db.session.execute(
|
db.session.execute(
|
||||||
select(ServiceInboundApi)
|
select(ServiceInboundApi.get_history_model()).filter_by(
|
||||||
.get_history_model()
|
id=saved_inbound_api.id
|
||||||
.filter_by(id=saved_inbound_api.id)
|
)
|
||||||
)
|
)
|
||||||
.scalars()
|
.scalars()
|
||||||
.all()
|
.all()
|
||||||
|
|||||||
Reference in New Issue
Block a user