本文整理汇总了Python中forgetracker.model.Ticket.paged_query_or_search方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.paged_query_or_search方法的具体用法?Python Ticket.paged_query_or_search怎么用?Python Ticket.paged_query_or_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forgetracker.model.Ticket
的用法示例。
在下文中一共展示了Ticket.paged_query_or_search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_paged_query_or_search
# 需要导入模块: from forgetracker.model import Ticket [as 别名]
# 或者: from forgetracker.model.Ticket import paged_query_or_search [as 别名]
def test_paged_query_or_search(self, query, search, tsearch):
app_cfg, user = mock.Mock(), mock.Mock()
mongo_query = 'mongo query'
solr_query = 'solr query'
kw = {'kw1': 'test1', 'kw2': 'test2'}
filter = None
Ticket.paged_query_or_search(app_cfg, user, mongo_query, solr_query, filter, **kw)
query.assert_called_once_with(app_cfg, user, mongo_query, sort=None, limit=None, page=0, **kw)
assert_equal(tsearch.query_filter_choices.call_count, 1)
assert_equal(tsearch.query_filter_choices.call_args[0][0], 'solr query')
assert_equal(search.call_count, 0)
query.reset_mock(), search.reset_mock(), tsearch.reset_mock()
filter = {'status': 'unread'}
Ticket.paged_query_or_search(app_cfg, user, mongo_query, solr_query, filter, **kw)
search.assert_called_once_with(app_cfg, user, solr_query, filter=filter, sort=None, limit=None, page=0, **kw)
assert_equal(query.call_count, 0)
assert_equal(tsearch.query_filter_choices.call_count, 0)