Coverage for compiler_admin / commands / user / signout.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 signout(username: str, force: bool = False, **kwargs):
11 """Sign a user out from all active sessions."""
12 account = GoogleAccount(username)
13 google = GoogleUsers()
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"Signout account {account} from all active sessions? (Y/n): ")
21 if not cont.lower().startswith("y"):
22 click.echo("Aborting signout.")
23 raise SystemExit(Result.SUCCESS)
25 click.echo(f"User exists, signing out from all active sessions: {account}")
27 google.signout(account)