def test_create_client(self): """ Test the creation of a new client """ client = helpers.create_dummy_client(1, self.test_user) self.verify_entity_instance(client, ClientEntity) self.verify_entity_instance(client.default_currency, CurrencyEntity) self.verify_entity_instance(client.default_language, LanguageEntity) # Verify the client is private to the user self.assertEqual(client.user.key(), self.test_user.key())
def setUp(self): super(Test_Invoice_Manager, self).setUp() self._test_user = helpers.create_dummy_user(1) self._test_currency = helpers.create_dummy_currency(1) self._test_language = helpers.create_dummy_language(77) self._test_client = helpers.create_dummy_client(1, self._test_user, currency = self._test_currency) self._invoice_manager = InvoiceManager(self._test_user) self._sub_total = 0 self._total = 0
def test_list_contacts(self): ''' Verify that the list contacts method returns the list of the user clients as a list of (id, contact) tuples ''' user1 = helpers.create_dummy_user(11) user2 = helpers.create_dummy_user(12) create_dummy_client(1, user1) create_dummy_client(2, user2) create_dummy_client(3, user1) create_dummy_client(4, user2) create_dummy_client(5, user1) create_dummy_client(6, user2) create_dummy_client(7, user1) client_manager_1 = ClientManager(user1) client_manager_2 = ClientManager(user2) clients_1 = client_manager_1.list_clients() clients_2 = client_manager_2.list_clients() self.assertEqual(len(clients_1), 4) self.assertEqual(len(clients_2), 3)
def test_add_client_contact(self): client = helpers.create_dummy_client(1, self.test_user) contact = helpers.add_dummy_contact(1, client, self.test_user) self.verify_entity_instance(contact, ClientContactEntity)