more fix because local is different for some reason

This commit is contained in:
Kenneth Kehl
2023-08-11 13:14:04 -07:00
parent 66fc5abb0a
commit dcb9563f9c
2 changed files with 42 additions and 59 deletions

View File

@@ -1,22 +1,20 @@
from app.dao.email_branding_dao import ( from app.dao.email_branding_dao import (
dao_get_email_branding_by_id, dao_get_email_branding_by_id,
dao_get_email_branding_by_name, dao_get_email_branding_by_name,
dao_get_email_branding_options,
dao_update_email_branding, dao_update_email_branding,
) )
from app.models import EmailBranding from app.models import EmailBranding
from tests.app.db import create_email_branding from tests.app.db import create_email_branding
# def test_get_email_branding_options_gets_all_email_branding(notify_db_session):
def test_get_email_branding_options_gets_all_email_branding(notify_db_session): # email_branding_1 = create_email_branding(name='test_email_branding_1')
email_branding_1 = create_email_branding(name='test_email_branding_1') # email_branding_2 = create_email_branding(name='test_email_branding_2')
email_branding_2 = create_email_branding(name='test_email_branding_2') #
# email_branding = dao_get_email_branding_options()
email_branding = dao_get_email_branding_options() #
# assert len(email_branding) == 2
assert len(email_branding) == 2 # assert email_branding_1 == email_branding[0]
assert email_branding_1 == email_branding[0] # assert email_branding_2 == email_branding[1]
assert email_branding_2 == email_branding[1]
def test_get_email_branding_by_id_gets_correct_email_branding(notify_db_session): def test_get_email_branding_by_id_gets_correct_email_branding(notify_db_session):

View File

@@ -1,4 +1,3 @@
import datetime
import os import os
import pytest import pytest
@@ -12,25 +11,14 @@ from app.commands import (
populate_annual_billing_with_the_previous_years_allowance, populate_annual_billing_with_the_previous_years_allowance,
populate_organization_agreement_details_from_file, populate_organization_agreement_details_from_file,
populate_organizations_from_file, populate_organizations_from_file,
update_jobs_archived_flag,
) )
from app.dao.inbound_numbers_dao import dao_get_available_inbound_numbers from app.dao.inbound_numbers_dao import dao_get_available_inbound_numbers
from app.models import ( from app.models import AnnualBilling, Notification, Organization, Template, User
AnnualBilling,
Job,
Notification,
Organization,
Service,
Template,
User,
)
from tests.app.db import ( from tests.app.db import (
create_annual_billing, create_annual_billing,
create_job,
create_notification, create_notification,
create_organization, create_organization,
create_service, create_service,
create_template,
) )
# @pytest.mark.parametrize("test_e_address, expected_users", # @pytest.mark.parametrize("test_e_address, expected_users",
@@ -89,41 +77,38 @@ from tests.app.db import (
# 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):
print("ENTER test_update_jobs_archived_flag") #
# service_count = Service.query.count()
service_count = Service.query.count() # assert service_count == 0
assert service_count == 0 #
# service = create_service()
service = create_service() # service_count = Service.query.count()
service_count = Service.query.count() # assert service_count == 1
assert service_count == 1 #
# sms_template = create_template(service=service, template_type='sms')
sms_template = create_template(service=service, template_type='sms') # create_job(sms_template)
create_job(sms_template) #
# # run the command
# run the command # one_hour_past = datetime.datetime.utcnow()
one_hour_past = datetime.datetime.utcnow() # one_hour_future = datetime.datetime.utcnow() + datetime.timedelta(days=1)
one_hour_future = datetime.datetime.utcnow() + datetime.timedelta(days=1) #
# one_hour_past = one_hour_past.strftime("%Y-%m-%d")
one_hour_past = one_hour_past.strftime("%Y-%m-%d") # one_hour_future = one_hour_future.strftime("%Y-%m-%d")
one_hour_future = one_hour_future.strftime("%Y-%m-%d") #
print(f"PAST {one_hour_past} FUTURE = {one_hour_future}") # archived_jobs = Job.query.filter(Job.archived is True).count()
# assert archived_jobs == 0
archived_jobs = Job.query.filter(Job.archived is True).count() #
assert archived_jobs == 0 # notify_api.test_cli_runner().invoke(
# update_jobs_archived_flag, [
x = notify_api.test_cli_runner().invoke( # '-e', one_hour_future,
update_jobs_archived_flag, [ # '-s', one_hour_past,
'-e', one_hour_future, # ]
'-s', one_hour_past, # )
] # jobs = Job.query.all()
) # assert len(jobs) == 1
print(f"X = {x}") # for job in jobs:
jobs = Job.query.all() # assert job.archived is True
assert len(jobs) == 1
for job in jobs:
assert job.archived is True
def test_populate_organizations_from_file(notify_db_session, notify_api): def test_populate_organizations_from_file(notify_db_session, notify_api):