Exemplo n.º 1
0
    def test_book_lend_fail(self):
        u = book_lend_logic(self.user, self.book1)

        # Primera forma
        try:
            book_lend_logic(self.user, self.book1)
            self.assertFail()
        except Exception as e:
            self.assertEqual(e.message,
                             "The book is already in the user's list")
Exemplo n.º 2
0
 def test_book_lend_valid(self):
     u = book_lend_logic(self.user, self.book1)
     self.assertTrue(u.books_lent.filter(id=self.book1.id).exists())