Esempio n. 1
0
 def test_remove_client(self):
     repoClients = Repo("Repoclients:")
     repoClients.add(Client(20, "John Wright"))
     repoClients.add(Client(40, "Andrei Ivan"))
     
     repoClients.remove(Client(40, None))
     assert(repoClients.size() == 1)
     assert(repoClients.get_all()[0].clientID == 20)
Esempio n. 2
0
 def test_remove_book(self):
     repoBooks = Repo("Repobooks:")
     repoBooks.add(Book(1, "The Secret Crusade", "Oliver Bowden"))
     repoBooks.add(Book(2, "The Illustrated Man", "Ray Bradbury"))
     
     repoBooks.remove(Book(1, None, None))
     assert(repoBooks.size() == 1)
     assert(repoBooks.get_all()[0].bookID == 2)
     
     with self.assertRaises(RepositoryError) as context:
         repoBooks.remove(Book(22, None, None))
     self.assertTrue("\n[REPOSITORY ERROR] -> Repobooks: Inexistend ID!\n" in str(context.exception))