本文整理汇总了Python中mozillians.groups.views._list_groups函数的典型用法代码示例。如果您正苦于以下问题:Python _list_groups函数的具体用法?Python _list_groups怎么用?Python _list_groups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_list_groups函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_list_groups
def test_list_groups(self, render_mock):
_list_groups(self.request, self.template, self.query)
ok_(render_mock.called)
request, template, data = render_mock.call_args[0]
eq_(template, self.template)
eq_(data['groups'].paginator.count, 2)
eq_(data['groups'].paginator.num_pages, 2)
eq_(data['groups'].number, 1)
eq_(data['groups'].object_list[0], self.group_1)
示例2: test_invalid_page
def test_invalid_page(self, render_mock):
self.request.GET = {'page': 'invalid'}
_list_groups(self.request, self.template, self.query)
ok_(render_mock.called)
request, template, data = render_mock.call_args[0]
eq_(data['groups'].number, 1)
示例3: test_invalid_sort
def test_invalid_sort(self, render_mock):
self.request.GET = {'sort': 'invalid'}
_list_groups(self.request, self.template, self.query)
ok_(render_mock.called)
request, template, data = render_mock.call_args[0]
eq_(data['groups'].object_list[0], self.group_1)
示例4: test_sort_by_fewest_members
def test_sort_by_fewest_members(self, render_mock):
self.request.GET = {'sort': 'num_members'}
_list_groups(self.request, self.template, self.query)
ok_(render_mock.called)
request, template, data = render_mock.call_args[0]
eq_(data['groups'].object_list[0], self.group_1)
示例5: test_sort_by_most_members
def test_sort_by_most_members(self, render_mock):
self.request.GET = {"sort": "-num_members"}
_list_groups(self.request, self.template, self.query)
ok_(render_mock.called)
request, template, data = render_mock.call_args[0]
eq_(data["groups"].object_list[0], self.group_2)