from tests import TestCase, main
-from m_librarian.search import search_authors
+from m_librarian.db import Author, Book
+from m_librarian.search import mk_search_conditions, \
+ search_authors, search_books
class TestSearch(TestCase):
search_authors('substring', False, {'surname': u'друг'}).count(),
3)
+ join_expressions = []
+ join_expressions.append(Book.j.authors)
+ conditions = mk_search_conditions(
+ Author, 'start', False, {'surname': u'друг'})
+ join_expressions.extend(conditions)
+ self.assertEqual(
+ search_books('start', False,
+ {'title': u'тест'}, join_expressions).count(),
+ 2)
+
if __name__ == "__main__":
main()