def test_get_book(self):
        with patch.object(Book, 'query') as mock_query:

            mock_filter_by_result = Mock()
            mock_query.filter_by.return_value = mock_filter_by_result

            mock_first_result = Mock()
            mock_filter_by_result.first.return_value = mock_first_result

            mock_first_result.json.return_value = self.mock_books[0]

            fake_isbn = 'someisbn'

            Book.get_book(fake_isbn)

            mock_query.filter_by.assert_called_with(isbn=fake_isbn)
            mock_filter_by_result.first.assert_called_once()
 def test_get_book_by_id(self):
     got_book = Book.get_book(12345)
     self.assertTrue(len(got_book) > 0) 
def get_book_by_isbn(isbn):
    book = Book.get_book(isbn)
    if not book:
        abort(404, 'Book with isbn {} not found'.format(isbn))
    return jsonify(book)