def test_longer_service_time_false(self): sample_bank = b.Bank() sample_bank.get_time = MagicMock(return_value=1) cust = c.Customer(sample_bank, 2) sample_teller = t.Teller() sample_bank.get_time = MagicMock(return_value=2) cust.go_to_teller(sample_teller) assert ~cust.accept_teller_service()
def test_teller_event_published(self): sample_bank = b.Bank() cust = c.Customer(sample_bank) sample_teller = t.Teller() sample_bank.save_event = MagicMock() cust.go_to_teller(sample_teller) assert sample_bank.save_event.called
def test_id_increments(self): sample_bank = b.Bank() cust = c.Customer(sample_bank) tell = t.Teller() service1 = e.CustomerServiceEvent(1, cust, tell) service2 = e.CustomerServiceEvent(1, cust, tell) assert service2.get_id() == service1.get_id() + 1
def test_time_reached_teller(self): sample_bank = b.Bank() cust = c.Customer(sample_bank) sample_teller = t.Teller() sample_bank.get_time = MagicMock(return_value=2) cust.go_to_teller(sample_teller) assert cust.get_time_reached_teller() == 2
def test_service_customer_with_two_turns_once(self): sample_teller = t.Teller() sample_bank = b.Bank() sample_cust = c.Customer(sample_bank, 2) sample_teller.take_customer(sample_cust) sample_teller.work_one_turn() assert sample_teller.has_customer()
def test_take_two_customers(self): sample_teller = t.Teller() sample_bank = b.Bank() sample_cust1 = c.Customer(sample_bank) sample_cust2 = c.Customer(sample_bank) sample_teller.take_customer(sample_cust1) with pytest.raises(Exception) as exception_info: sample_teller.take_customer(sample_cust2)
def test_take_customer(self): sample_teller = t.Teller() sample_bank = b.Bank() sample_cust = c.Customer(sample_bank) sample_cust.go_to_teller = MagicMock(return_value=1) sample_teller.take_customer(sample_cust) assert sample_cust.go_to_teller.called
def test_total_time(self): sample_bank = b.Bank() sample_bank.get_time = MagicMock(return_value=1) cust = c.Customer(sample_bank) sample_teller = t.Teller() sample_bank.get_time = MagicMock(return_value=2) cust.go_to_teller(sample_teller) cust.accept_teller_service() assert cust.get_total_time() == 2
def hire_tellers(self, num_tellers): """Add a number of tellers to the bank""" for i in range(0, num_tellers): new_teller = t.Teller() self._tellers.append(new_teller)
def test_accept_teller_service(self): sample_bank = b.Bank() cust = c.Customer(sample_bank) sample_teller = t.Teller() cust.go_to_teller(sample_teller) assert cust.accept_teller_service()
def test_id_increments(self): first_teller = t.Teller() second_teller = t.Teller() assert second_teller.get_id() == first_teller.get_id() + 1