Пример #1
0
 def test_bank_not_hold_duplicate_accounts(self):
     self.bank.accounts.clear()
     self.bank.add_account(Account('001', 100))
     self.bank.add_account(Account('002', 200))
     account_bal = self.bank.accounts['001']
     self.assertRaises(AccountExists,
                       self.bank.add_account(Account('001', 300)))
     account1_bal = self.bank.accounts['001']
     self.assertEqual(account1_bal, account_bal)
     self.assertEqual(100, account1_bal)
     self.assertEqual(len(self.bank.accounts), 2)
Пример #2
0
 def test_bank_can_terminate_an_account(self):
     self.bank.add_account(Account('1001', 700))
     self.assertIn('1001', self.bank.accounts.keys())
     self.bank.remove_account('1001')
     self.assertNotIn('1001', self.bank.accounts.keys())
Пример #3
0
 def test_bank_can_get_account_balance(self):
     self.bank.add_account(Account('999', 900))
     self.assertEqual(900, self.bank.get_account_balance('999'))
Пример #4
0
 def test_add_account_creates_new_account(self):
     self.bank.add_account(Account('001', 100))
     self.assertEqual(len(self.bank.accounts), 1)
     self.bank.add_account(Account('002', 100))
     self.assertEqual(len(self.bank.accounts), 2)
 def setUp(self):
     initial_account = Account('001', 100)
     self.inti_size = len(initial_account.all_accounts)
Пример #6
0
 def test_account_object_can_be_created(self):
     account = Account('012', 100)
     self.assertEqual(1, len(account.all_accounts))
Пример #7
0
 def test_every_new_account_is_stored(self):
     a = Account('1020', 900)
     init_accounts = len(a.all_accounts)
     b = FixedDepositAccount('909', 100)
     self.assertEqual(init_accounts+1, len(b.all_accounts))
Пример #8
0
 def test_account_returns_current_balance(self):
     account1 = Account('001', 500)
     self.assertEqual(account1.get_balance(), 500)