mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-25 00:33:41 -04:00
cleanup
This commit is contained in:
@@ -139,8 +139,6 @@ def purge_functional_test_data(user_email_prefix):
|
|||||||
print(f"Deleting user {usr.id} which is not part of any services")
|
print(f"Deleting user {usr.id} which is not part of any services")
|
||||||
delete_user_verify_codes(usr)
|
delete_user_verify_codes(usr)
|
||||||
delete_model_user(usr)
|
delete_model_user(usr)
|
||||||
raise Exception(f"RAN with user {usr}")
|
|
||||||
raise Exception("NO USERS")
|
|
||||||
|
|
||||||
|
|
||||||
@notify_command(name='insert-inbound-numbers')
|
@notify_command(name='insert-inbound-numbers')
|
||||||
@@ -256,7 +254,7 @@ def bulk_invite_user_to_service(file_name, service_id, user_id, auth_type, permi
|
|||||||
@click.option('-e', '--end_date', required=True, help="end date inclusive", type=click_dt(format='%Y-%m-%d'))
|
@click.option('-e', '--end_date', required=True, help="end date inclusive", type=click_dt(format='%Y-%m-%d'))
|
||||||
def update_jobs_archived_flag(start_date, end_date):
|
def update_jobs_archived_flag(start_date, end_date):
|
||||||
|
|
||||||
print('Archiving jobs created between {} to {}'.format(start_date, end_date))
|
current_app.logger.info('Archiving jobs created between {} to {}'.format(start_date, end_date))
|
||||||
|
|
||||||
process_date = start_date
|
process_date = start_date
|
||||||
total_updated = 0
|
total_updated = 0
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class UserSchema(BaseSchema):
|
|||||||
permissions = fields.Method("user_permissions", dump_only=True)
|
permissions = fields.Method("user_permissions", dump_only=True)
|
||||||
password_changed_at = field_for(models.User, 'password_changed_at', format=DATETIME_FORMAT_NO_TIMEZONE)
|
password_changed_at = field_for(models.User, 'password_changed_at', format=DATETIME_FORMAT_NO_TIMEZONE)
|
||||||
created_at = field_for(models.User, 'created_at', format=DATETIME_FORMAT_NO_TIMEZONE)
|
created_at = field_for(models.User, 'created_at', format=DATETIME_FORMAT_NO_TIMEZONE)
|
||||||
updated_atx = FlexibleDateTime()
|
updated_at = FlexibleDateTime()
|
||||||
logged_in_at = FlexibleDateTime()
|
logged_in_at = FlexibleDateTime()
|
||||||
auth_type = field_for(models.User, 'auth_type')
|
auth_type = field_for(models.User, 'auth_type')
|
||||||
password = fields.String(required=True, load_only=True)
|
password = fields.String(required=True, load_only=True)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ def test_purge_functional_test_data_bad_mobile(notify_db_session, notify_api):
|
|||||||
user_count = User.query.count()
|
user_count = User.query.count()
|
||||||
assert user_count == 0
|
assert user_count == 0
|
||||||
# run the command
|
# run the command
|
||||||
x = notify_api.test_cli_runner().invoke(
|
command_response = notify_api.test_cli_runner().invoke(
|
||||||
create_test_user, [
|
create_test_user, [
|
||||||
'--email', 'somebody+7af2cdb0-7cbc-44dc-a5d0-f817fc6ee94e@fake.gov',
|
'--email', 'somebody+7af2cdb0-7cbc-44dc-a5d0-f817fc6ee94e@fake.gov',
|
||||||
'--mobile_number', '555-555-55554444',
|
'--mobile_number', '555-555-55554444',
|
||||||
@@ -72,7 +72,7 @@ def test_purge_functional_test_data_bad_mobile(notify_db_session, notify_api):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
# The bad mobile phone number results in a bad parameter error, leading to a system exit 2 and no entry made in db
|
# The bad mobile phone number results in a bad parameter error, leading to a system exit 2 and no entry made in db
|
||||||
assert "SystemExit(2)" in str(x)
|
assert "SystemExit(2)" in str(command_response)
|
||||||
user_count = User.query.count()
|
user_count = User.query.count()
|
||||||
assert user_count == 0
|
assert user_count == 0
|
||||||
|
|
||||||
@@ -115,14 +115,14 @@ def test_populate_organizations_from_file(notify_db_session, notify_api):
|
|||||||
f = open(file_name, "a")
|
f = open(file_name, "a")
|
||||||
f.write(text)
|
f.write(text)
|
||||||
f.close()
|
f.close()
|
||||||
x = notify_api.test_cli_runner().invoke(
|
command_response = notify_api.test_cli_runner().invoke(
|
||||||
populate_organizations_from_file, [
|
populate_organizations_from_file, [
|
||||||
'-f', file_name
|
'-f', file_name
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
print(f"X = {x}")
|
print(f"command_response = {command_response}")
|
||||||
|
|
||||||
org_count = Organization.query.count()
|
org_count = Organization.query.count()
|
||||||
assert org_count == 1
|
assert org_count == 1
|
||||||
@@ -146,12 +146,12 @@ def test_populate_organization_agreement_details_from_file(notify_db_session, no
|
|||||||
f = open(file_name, "a")
|
f = open(file_name, "a")
|
||||||
f.write(text)
|
f.write(text)
|
||||||
f.close()
|
f.close()
|
||||||
x = notify_api.test_cli_runner().invoke(
|
command_response = notify_api.test_cli_runner().invoke(
|
||||||
populate_organization_agreement_details_from_file, [
|
populate_organization_agreement_details_from_file, [
|
||||||
'-f', file_name
|
'-f', file_name
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
print(f"X = {x}")
|
print(f"command_response = {command_response}")
|
||||||
|
|
||||||
org_count = Organization.query.count()
|
org_count = Organization.query.count()
|
||||||
assert org_count == 1
|
assert org_count == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user