Coverage for compiler_admin / commands / user / delete.py: 100%
19 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-28 05:48 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-28 05:48 +0000
1import click
3from compiler_admin import Result
4from compiler_admin.services.google import GoogleAccount, GoogleUsers
7@click.command()
8@click.option("-f", "--force", is_flag=True, help="Don't ask for confirmation.")
9@click.argument("username")
10def delete(username: str, force: bool = False, **kwargs):
11 """Delete a user account."""
12 account = GoogleAccount(username)
13 google = GoogleUsers(account)
15 if not account.exists():
16 click.echo(f"User does not exist: {account}")
17 raise SystemExit(Result.FAILURE)
19 if not force:
20 cont = input(f"Delete account {account}? (Y/n): ")
21 if not cont.lower().startswith("y"):
22 click.echo("Aborting delete.")
23 return
25 click.echo(f"User exists, deleting: {account}")
26 google.delete(account)