Exemple #1
0
 def test_update_client(self):
     repo = Repository()
     undo_service = UndoService()
     client_service = ClientService(repo, undo_service)
     client_service.add_client(1, "Popescu Alin")
     client_service.update_client(1, "Ionescu George")
     list_clients = client_service.list_clients()
     self.assertEqual(len(list_clients), 1)
     with self.assertRaises(IdError):        # client does not exist
         client_service.update_client(2, "Mara")
Exemple #2
0
 def test_delete_client(self):
     repo = Repository()
     undo_service = UndoService()
     client_service = ClientService(repo, undo_service)
     client_service.add_client(1, "Popescu Alin")
     client_service.add_client(2, "Ionescu Maria")
     client_service.add_client(3, "Trifan Ion")
     client_service.delete_client(2)
     list_clients = client_service.list_clients()
     self.assertEqual(len(list_clients), 2)
     with self.assertRaises(IdError):    # client does not exist
         client_service.delete_client(4)
Exemple #3
0
    def test_add_client(self):
        the_id = 1
        name = "Popescu Alin"
        repo = Repository()
        undo_service = UndoService()
        client_service = ClientService(repo, undo_service)
        client_service.add_client(the_id, name)
        list_clients = client_service.list_clients()
        self.assertEqual(len(list_clients), 1)

        with self.assertRaises(IdError):       # client already added
            client_service.add_client(1, "Mara Pop")