def test_create_account_success(): account_num = 1234567 account_name = "Alex" expected_transaction = Transaction("NEW", account_num, "000", "0000000", account_name).create_transaction_line() transaction = createAccount(account_num, account_name).create_transaction_line() assert transaction == expected_transaction
def deposit(account_num, amount, mode, deposits): new_daily_deposits = validateDepositAmount(account_num, amount, mode, deposits) if (new_daily_deposits == False): print("Invalid deposit amount") return False, deposits else: return Transaction("DEP", account_num, amount, "0000000", '***'), deposits
def test_create_account_success(): master_accounts_list = {} assert master_accounts_list == {} transaction = Transaction('NEW', 1234567, 100, 0000000, 'testaccount') master_accounts_list = backendController(transaction, master_accounts_list) assert master_accounts_list[1234567].balance == 0 assert master_accounts_list[1234567].account_name == 'testaccount' assert master_accounts_list[1234567].account_number == 1234567
def transfer(mode, account_num1, account_num2, amount, transfers): # transaction object new_daily_transfers = validateTransferAmount(amount, int(account_num1), mode, transfers) if (new_daily_transfers == False): print("Invalid transfer amount") return False, transfers else: return Transaction("XFR", account_num2, amount, account_num1, '***'), transfers
def withdraw(account_num, amount, mode, withdrawals): # updated this function to match deposit above new_daily_withdrawals = validateWithdrawAmount(account_num, amount, mode, withdrawals) if (new_daily_withdrawals == False): print("Invalid withdrawal amount") return False, withdrawals else: return Transaction("WDR", account_num, amount, "0000000", '***'), withdrawals '''
def test_withdraw_success_agent(): daily_withdrawals = {1234567: 0} account_num = 1234567 amount = 10000 #agent mode mode = 1 transaction, new_daily_withdrawals = withdraw(account_num, amount, mode, daily_withdrawals) expected_transaction = Transaction("WDR", account_num, amount, "0000000", '***').create_transaction_line() transaction = transaction.create_transaction_line() daily_withdrawals[account_num] = amount assert transaction == expected_transaction assert daily_withdrawals == new_daily_withdrawals
def test_deposit_success_agent(): daily_deposits = {1234567: 0} account_num = 1234567 amount = 10000 # Agent mode mode = 1 # Call our deposit function transaction, new_daily_deposits = deposit(account_num, amount, mode, daily_deposits) # Create an expected Transaction expected_transaction = Transaction("DEP", account_num, amount, "0000000", '***').create_transaction_line() # We will compare the strings transaction = transaction.create_transaction_line() # update our initial daily_deposits dict to be our expected dict daily_deposits[account_num] = amount assert transaction == expected_transaction assert daily_deposits == new_daily_deposits
def test_transfer_success_agent(): daily_transfer = {1234567: 0} account_num_from = 1234567 account_num_to = 1122334 amount = 10 # Agent mode mode = 1 # Call our deposit function transaction, new_daily_transfers = transfer(mode, account_num_from, account_num_to, amount, daily_transfer) # Create an expected Transaction expected_transaction = Transaction("XFR", account_num_to, amount, account_num_from, '***').create_transaction_line() # We will compare the strings transaction = transaction.create_transaction_line() # update our initial daily_deposits dict to be our expected dict daily_transfer[account_num_from] = amount assert transaction == expected_transaction assert daily_transfer == new_daily_transfers
def test_withdraw_valid_amount(): master_accounts_list = {} master_accounts_list[1234567] = MasterAccount(1234567, 1000, 'testaccount') transaction = Transaction('WDR', 1234567, 100, 0000000, '***') backendController(transaction, master_accounts_list) assert master_accounts_list[1234567].balance == 900