Add account and org destroy commands. Fix tests (#3552)

* Add account and org destroy commands. Fix tests

* fix tests

* fix

* fix texts
This commit is contained in:
ShahRustam
2020-06-09 15:50:37 +03:00
committed by GitHub
parent 78546e9246
commit a5547491ed
8 changed files with 454 additions and 680 deletions

View File

@@ -178,6 +178,23 @@ def account_update(current_password, **kwargs):
return click.secho("Please re-login.", fg="yellow")
@cli.command("destroy", short_help="Destroy account")
def account_destroy():
client = AccountClient()
click.confirm(
"Are you sure you want to delete the %s user account?\n"
"Warning! All linked data will be permanently removed and can not be restored."
% client.get_account_info().get("profile").get("username"),
abort=True,
)
client.destroy_account()
try:
client.logout()
except AccountNotAuthorized:
pass
return click.secho("User account has been destroyed.", fg="green",)
@cli.command("show", short_help="PIO Account information")
@click.option("--offline", is_flag=True)
@click.option("--json-output", is_flag=True)