def test_deposit(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) self.assertTrue(atm.deposit(self.valid_account_index, 1000)) expected_value = 1123 self.assertEqual( expected_value, atm.retrieve_account(self.valid_account_index)['balance'])
def test_retrieve_account(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) expected_value = { 'account_index': 1, 'account_number': '11-22-33-44', 'account_name': '생활비', 'balance': 123 } self.assertDictEqual(expected_value, atm.retrieve_account(self.valid_account_index))
def test_list_accounts(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) expected_value = [{ 'account_index': 1, 'account_number': '11-22-33-44', 'account_name': '생활비' }, { 'account_index': 2, 'account_number': '11-22-33-55', 'account_name': '전재산' }] self.assertListEqual(expected_value, atm.list_accounts())
def test_withdraw_with_more_money_than_saved(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) self.assertFalse(atm.withdraw(self.valid_account_index, 1000000))
def test_withdraw_with_invalid_account_index(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) self.assertFalse(atm.withdraw(self.invalid_account_index, 10))
def test_retrieve_account_with_invalid_account_index(self): atm = atm_controller.ATMController(self.valid_card_number, self.pin_number) expected_value = {} self.assertDictEqual(expected_value, atm.retrieve_account(self.invalid_account_index))
def test_list_accounts_with_invalid_card(self): atm = atm_controller.ATMController(self.invalid_card_number, self.pin_number) expected_value = [] self.assertListEqual(expected_value, atm.list_accounts())