コード例 #1
0
 def test_remove_resource(self):
     """Test for remove_resource method"""
     s1 = System()
     b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
     self.assertEqual(s1.remove_resource(b1), print())
     s1.add_resource(b1)
     self.assertIn(b1, s1.catalogue)
     s1.remove_resource(b1)
     self.assertNotIn(b1, s1.catalogue)
コード例 #2
0
 def return_book_process(self):
     """Test for return_book_process method"""
     s1 = System()
     b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123")
     m1 = Members("Richard", "Blackmore", "14-04-1945", "Weston")
     s1.add_resource(b1)
     s1.lending_process(b1, m1)
     s1.remove_resource(b1)
     #prove that the return of a book doen't take place if not in the ctalogue, 
     #but also that in the remove_resource method should be added somthing to remeove that book from all borrowers
     #or doesn't allow the operation if not returned
     s1.return_book_process(b1, False, "none")
     self.assertEqual(b1.get_borrower(), m1)
     self.assertIn(b1, m1.get_borrowed_books())
     s1.add_resource(b1)
     self.assertEqual(b1.get_borrower(), None)
     self.assertNotIn(b1, m1.get_borrowed_books())