示例#1
0
    def testSearchBookByName(self):
        book_one = Book(name='New World Order')
        book_two = Book(name='Things Fall Apart')
        book_three = Book(name='Pinkberry')
        book_four = Book(name='New Scopes')
        db.session.add_all([book_one, book_two, book_three, book_four])
        db.session.commit()

        self.assertEqual(len(Book.findByName('New World')), 1)
        self.assertEqual(len(Book.findByName('N')), 2)