def test_get_all_books(self, patched_book_query, patched_book_json):
        mock_book_objects = [
            Book(**book_data) for book_data in self.mock_books
        ]
        patched_book_query.all.return_value = mock_book_objects
        patched_book_json.return_value = {}

        result = Book.get_all_books()

        patched_book_query.all.assert_called_once()
        self.assertEqual(len(patched_book_json.mock_calls),
                         len(self.mock_books))
        self.assertEqual(len(self.mock_books), len(result))
def get_books():
    return jsonify({'books': Book.get_all_books()})