mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 16:23:44 -04:00
fix test
This commit is contained in:
@@ -262,6 +262,11 @@ def bulk_invite_user_to_service(file_name, service_id, user_id, auth_type, permi
|
|||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
|
# TODO this is commented out because there is a conflict between
|
||||||
|
# the version of wheel we need to be on (0.46.2 or greater) and
|
||||||
|
# the click-datetime dependency, which insists wheel be 0.45.0 or lower.
|
||||||
|
# So need to rewrite this command to not use click-datetime, or see
|
||||||
|
# if the owners of click-datetime updated it (not as of 1/22/2026).
|
||||||
# @notify_command(name="archive-jobs-created-between-dates")
|
# @notify_command(name="archive-jobs-created-between-dates")
|
||||||
# @click.option(
|
# @click.option(
|
||||||
# "-s",
|
# "-s",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import pytest
|
|||||||
from sqlalchemy import func, select
|
from sqlalchemy import func, select
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.commands import (
|
from app.commands import ( # update_jobs_archived_flag,
|
||||||
_clear_templates_from_cache,
|
_clear_templates_from_cache,
|
||||||
_update_template,
|
_update_template,
|
||||||
associate_services_to_organizations,
|
associate_services_to_organizations,
|
||||||
@@ -32,7 +32,6 @@ from app.commands import (
|
|||||||
promote_user_to_platform_admin,
|
promote_user_to_platform_admin,
|
||||||
purge_csv_bucket,
|
purge_csv_bucket,
|
||||||
purge_functional_test_data,
|
purge_functional_test_data,
|
||||||
update_jobs_archived_flag,
|
|
||||||
update_templates,
|
update_templates,
|
||||||
)
|
)
|
||||||
from app.dao.inbound_numbers_dao import dao_get_available_inbound_numbers
|
from app.dao.inbound_numbers_dao import dao_get_available_inbound_numbers
|
||||||
@@ -46,9 +45,8 @@ from app.enums import (
|
|||||||
TemplateType,
|
TemplateType,
|
||||||
UserState,
|
UserState,
|
||||||
)
|
)
|
||||||
from app.models import (
|
from app.models import ( # Job,
|
||||||
AnnualBilling,
|
AnnualBilling,
|
||||||
Job,
|
|
||||||
Notification,
|
Notification,
|
||||||
Organization,
|
Organization,
|
||||||
Service,
|
Service,
|
||||||
@@ -56,13 +54,11 @@ from app.models import (
|
|||||||
User,
|
User,
|
||||||
)
|
)
|
||||||
from app.utils import utc_now
|
from app.utils import utc_now
|
||||||
from tests.app.db import (
|
from tests.app.db import ( # create_job,; create_template,
|
||||||
create_annual_billing,
|
create_annual_billing,
|
||||||
create_job,
|
|
||||||
create_notification,
|
create_notification,
|
||||||
create_organization,
|
create_organization,
|
||||||
create_service,
|
create_service,
|
||||||
create_template,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -120,35 +116,35 @@ def test_purge_functional_test_data_bad_mobile(notify_db_session, notify_api):
|
|||||||
assert user_count == 0
|
assert user_count == 0
|
||||||
|
|
||||||
|
|
||||||
def test_update_jobs_archived_flag(notify_db_session, notify_api):
|
# def test_update_jobs_archived_flag(notify_db_session, notify_api):
|
||||||
service = create_service()
|
# service = create_service()
|
||||||
|
|
||||||
sms_template = create_template(service=service, template_type=TemplateType.SMS)
|
# sms_template = create_template(service=service, template_type=TemplateType.SMS)
|
||||||
create_job(sms_template)
|
# create_job(sms_template)
|
||||||
|
|
||||||
right_now = utc_now()
|
# right_now = utc_now()
|
||||||
tomorrow = right_now + timedelta(days=1)
|
# tomorrow = right_now + timedelta(days=1)
|
||||||
|
|
||||||
right_now = right_now.strftime("%Y-%m-%d")
|
# right_now = right_now.strftime("%Y-%m-%d")
|
||||||
tomorrow = tomorrow.strftime("%Y-%m-%d")
|
# tomorrow = tomorrow.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
stmt = select(Job).where(Job.archived is True)
|
# stmt = select(Job).where(Job.archived is True)
|
||||||
archived_jobs = db.session.execute(stmt).scalar() or 0
|
# archived_jobs = db.session.execute(stmt).scalar() or 0
|
||||||
assert archived_jobs == 0
|
# assert archived_jobs == 0
|
||||||
|
|
||||||
notify_api.test_cli_runner().invoke(
|
# notify_api.test_cli_runner().invoke(
|
||||||
update_jobs_archived_flag,
|
# update_jobs_archived_flag,
|
||||||
[
|
# [
|
||||||
"-e",
|
# "-e",
|
||||||
tomorrow,
|
# tomorrow,
|
||||||
"-s",
|
# "-s",
|
||||||
right_now,
|
# right_now,
|
||||||
],
|
# ],
|
||||||
)
|
# )
|
||||||
jobs = db.session.execute(select(Job)).scalars().all()
|
# jobs = db.session.execute(select(Job)).scalars().all()
|
||||||
assert len(jobs) == 1
|
# assert len(jobs) == 1
|
||||||
for job in jobs:
|
# for job in jobs:
|
||||||
assert job.archived is True
|
# assert job.archived is True
|
||||||
|
|
||||||
|
|
||||||
def _get_organization_query_count():
|
def _get_organization_query_count():
|
||||||
|
|||||||
Reference in New Issue
Block a user