def test_deposit_withdraw(self): logged_user = sql_manager.login('Tester', '123Ab#78') sql_manager.deposit(10000, sql_manager.get_tan(logged_user)[0], logged_user) self.assertEqual(sql_manager.display_balance(logged_user), 10000.00) sql_manager.withdraw(1000, sql_manager.get_tan(logged_user)[1], logged_user) self.assertEqual(sql_manager.display_balance(logged_user), 9000.00)
def logged_menu(logged_user): print("Welcome you are logged in as: " + logged_user.get_username()) while True: command = input("Logged>>") if command == 'info': print("You are: " + logged_user.get_username()) print("Your id is: " + str(logged_user.get_id())) print("Your balance is:" + str(logged_user.get_balance()) + '$') elif command == 'changepass': new_pass = getpass.getpass("Enter your new password: "******"Enter your new message: ") sql_manager.change_message(new_message, logged_user) elif command == 'show-message': print(logged_user.get_message()) elif command == 'deposit': amount = input("Enter the amount of money you want to deposit: ") tan = input("Enter TAN code: ") sql_manager.deposit(amount, tan, logged_user) elif command == 'withdraw': amount = input("Enter the amount of money you want to withdraw: ") tan = input("Enter TAN code: ") sql_manager.withdraw(amount, tan, logged_user) elif command == 'display-balance': print(sql_manager.display_balance(logged_user)) elif command == 'get-tan': sql_manager.get_tan(logged_user) elif command == 'help': print("info - for showing account info") print("changepass - for changing passowrd") print("change-message - for changing users message") print("show-message - for showing users message") print("deposit - to deposit into your account") print("withdraw - to withdraw from your account") print("display-balance - to display your current balance") print("get-tan - to send TAN codes to your email, you need " \ "them to make a deposit or to withdraw!") print("logout - to return to the main menu") elif command == 'logout': break
def logged_menu(logged_user): print("Welcome you are logged in as: " + logged_user.get_username()) while True: command = input("Logged>>") if command == "info": print("You are: " + logged_user.get_username()) print("Your id is: " + str(logged_user.get_id())) print("Your balance is:" + str(logged_user.get_balance()) + "$") elif command == "changepass": new_pass = getpass.getpass("Enter your new password: "******"change-message": new_message = input("Enter your new message: ") sql_manager.change_message(new_message, logged_user) elif command == "show-message": print(logged_user.get_message()) elif command == "deposit": amount = input("Enter the amount of money you want to deposit: ") tan = input("Enter TAN code: ") sql_manager.deposit(amount, tan, logged_user) elif command == "withdraw": amount = input("Enter the amount of money you want to withdraw: ") tan = input("Enter TAN code: ") sql_manager.withdraw(amount, tan, logged_user) elif command == "display-balance": print(sql_manager.display_balance(logged_user)) elif command == "get-tan": sql_manager.get_tan(logged_user) elif command == "help": print("info - for showing account info") print("changepass - for changing passowrd") print("change-message - for changing users message") print("show-message - for showing users message") print("deposit - to deposit into your account") print("withdraw - to withdraw from your account") print("display-balance - to display your current balance") print("get-tan - to send TAN codes to your email, you need " "them to make a deposit or to withdraw!") print("logout - to return to the main menu") elif command == "logout": break