diff --git a/app/commands.py b/app/commands.py index 39d399a2e..d0f7df409 100644 --- a/app/commands.py +++ b/app/commands.py @@ -835,13 +835,9 @@ def create_new_service(name, message_limit, restricted, email_from, created_by_i @notify_command(name="promote-user-to-platform-admin") @click.option("-u", "--user-email-address", required=True, prompt=True) def promote_user_to_platform_admin(user_email_address): - print("enter") + # If the email address is wrong, sqlalchemy will automatically raise a NoResultFound error which is what we want. + # See tests. user = get_user_by_email(user_email_address) - print(f"user is {user}") - # if not user: - # raise ValueError(f"could not find user for {user_email_address}") - print("ok to proceed") user.platform_admin = True db.session.add(user) db.session.commit() - print("finished") diff --git a/tests/app/test_commands.py b/tests/app/test_commands.py index bc9010b6a..c13ac3dd3 100644 --- a/tests/app/test_commands.py +++ b/tests/app/test_commands.py @@ -405,14 +405,13 @@ def test_promote_user_to_platform_admin( assert sample_user.platform_admin is False assert sample_platform_admin.platform_admin is True - result = notify_api.test_cli_runner().invoke( + notify_api.test_cli_runner().invoke( promote_user_to_platform_admin, [ "-u", "notify@digital.fake.gov", ], ) - print(result) user = get_user_by_email("notify@digital.fake.gov") assert user.platform_admin is True