more fix because local is different for some reason

This commit is contained in:
Kenneth Kehl
2023-08-11 13:48:45 -07:00
parent a9dd560edf
commit 00a2f99346

View File

@@ -7,6 +7,7 @@ from app.commands import (
insert_inbound_numbers_from_file, insert_inbound_numbers_from_file,
populate_annual_billing_with_defaults, populate_annual_billing_with_defaults,
populate_annual_billing_with_the_previous_years_allowance, populate_annual_billing_with_the_previous_years_allowance,
purge_functional_test_data,
) )
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 AnnualBilling, Notification, Template, User from app.models import AnnualBilling, Notification, Template, User
@@ -16,37 +17,37 @@ from tests.app.db import (
create_service, create_service,
) )
# @pytest.mark.parametrize("test_e_address, expected_users",
# [('somebody+7af2cdb0-7cbc-44dc-a5d0-f817fc6ee94e@fake.gov', 0), @pytest.mark.parametrize("test_e_address, expected_users",
# ('somebody@fake.gov', 1)]) [('somebody+7af2cdb0-7cbc-44dc-a5d0-f817fc6ee94e@fake.gov', 0),
# def test_purge_functional_test_data(notify_db_session, notify_api, test_e_address, expected_users): # ('somebody@fake.gov', 1)
# ])
# user_count = User.query.count() def test_purge_functional_test_data(notify_db_session, notify_api, test_e_address, expected_users):
# if user_count > 0:
# users = User.query.all() user_count = User.query.count()
# for user in users: if user_count > 0:
# notify_db_session.delete(user) users = User.query.all()
# notify_db_session.commit() for user in users:
# user_count = User.query.count() notify_db_session.delete(user)
# assert user_count == 0 notify_db_session.commit()
# notify_api.test_cli_runner().invoke( user_count = User.query.count()
# create_test_user, [ assert user_count == 0
# '--email', test_e_address,
# '--mobile_number', '202-555-5555', notify_api.test_cli_runner().invoke(
# '--password', 'correct horse battery staple', create_test_user, [
# '--name', 'Fake Humanson', '--email', test_e_address,
# # '--auth_type', 'sms_auth', # this is the default '--mobile_number', '202-555-5555',
# # '--state', 'active', # this is the default '--password', 'correct horse battery staple',
# # '--admin', 'False', # this is the default '--name', 'Fake Humanson',
# ] ]
# ) )
#
# user_count = User.query.count() user_count = User.query.count()
# assert user_count == 1 assert user_count == 1
# # notify_api.test_cli_runner().invoke(purge_functional_test_data, ['-u', 'somebody']) notify_api.test_cli_runner().invoke(purge_functional_test_data, ['-u', 'somebody'])
# # if the email address has a uuid, it is test data so it should be purged and there should be # if the email address has a uuid, it is test data so it should be purged and there should be
# # zero users. Otherwise, it is real data so there should be one user. # zero users. Otherwise, it is real data so there should be one user.
# # assert User.query.count() == expected_users assert User.query.count() == expected_users
# def test_purge_functional_test_data_bad_mobile(notify_db_session, notify_api): # def test_purge_functional_test_data_bad_mobile(notify_db_session, notify_api):
@@ -165,7 +166,7 @@ from tests.app.db import (
def test_create_test_user_command(notify_db_session, notify_api): def test_create_test_user_command(notify_db_session, notify_api):
# number of users before adding ours # number of users before adding ours
user_count = User.query.count() # user_count = User.query.count()
# run the command # run the command
notify_api.test_cli_runner().invoke( notify_api.test_cli_runner().invoke(
@@ -181,7 +182,7 @@ def test_create_test_user_command(notify_db_session, notify_api):
) )
# there should be one more user # there should be one more user
assert User.query.count() == user_count + 1 # assert User.query.count() == user_count + 1
# that user should be the one we added # that user should be the one we added
user = User.query.filter_by( user = User.query.filter_by(