sys.exit(2) if args['asJson']: print(json.dumps(account.__dict__, sort_keys=True, indent=4)) else: print("Informations sur le compte %s :" % account.name) print(account.showAttr()) elif args['deleteAccount'] == True: if not args['email']: raise Exception("Missing 'email' argument") try: AccountService.deleteAccount(args['email']) except Exception as err: print("Echec d'exécution : %s" % err) sys.exit(2) print("Le compte %s a été supprimé" % args['email']) elif args['preDeleteAccount'] == True: if not args['email']: raise Exception("Missing 'email' argument") try: AccountService.preDeleteAccount(args['email'])
def delete_account(name): account = AccountService.getAccount(name) if account != None: AccountService.deleteAccount(name)
def test_deleteAccount_cas_compteInexistant(test_config): with pytest.raises(ServiceException): AccountService.deleteAccount(test_config['accountname'])
def test_deleteAccount_cas_Normal(test_config): AccountService.deleteAccount(test_config['accountname']) account = AccountService.getAccount(test_config['accountname']) assert account == None