本文整理汇总了Python中mozillians.groups.tests.GroupAliasFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python GroupAliasFactory.create方法的具体用法?Python GroupAliasFactory.create怎么用?Python GroupAliasFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozillians.groups.tests.GroupAliasFactory
的用法示例。
在下文中一共展示了GroupAliasFactory.create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_membership_group_matches_alias
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_set_membership_group_matches_alias(self):
group_1 = GroupFactory.create(name="foo")
group_2 = GroupFactory.create(name="lo")
GroupAliasFactory.create(alias=group_2, name="bar")
user = UserFactory.create()
user.userprofile.set_membership(Group, ["foo", "bar"])
eq_(set(user.userprofile.groups.all()), set([group_1, group_2]))
示例2: test_search_distict_results
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_search_distict_results(self):
group_1 = GroupFactory.create(name='automation', visible=True)
GroupAliasFactory.create(alias=group_1, name='automation development')
GroupAliasFactory.create(alias=group_1, name='automation services')
results = Group.search('automation')
eq_(len(results), 1)
eq_(results[0], group_1)
示例3: test_name_unique
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_name_unique(self):
group = GroupFactory.create()
GroupAliasFactory.create(alias=group, name='bar')
form = forms.GroupCreateForm({'name': 'bar', 'accepting_new_members': 'by_request'})
ok_(not form.is_valid())
ok_('name' in form.errors)
msg = u'This name already exists.'
ok_(msg in form.errors['name'])
示例4: test_name_unique
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_name_unique(self):
group = GroupFactory.create()
GroupAliasFactory.create(alias=group, name='bar')
form = GroupForm({'name': 'bar'})
ok_(not form.is_valid())
ok_('name' in form.errors)
msg = u'This name already exists.'
ok_(msg in form.errors['name'])
示例5: test_alias_redirection
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_alias_redirection(self):
user = UserFactory.create()
group = GroupFactory.create()
group_alias = GroupAliasFactory.create(alias=group)
url = reverse('groups:show_group', kwargs={'url': group_alias.url})
with self.login(user) as client:
response = client.get(url, follow=True)
eq_(response.status_code, 200)
eq_(response.context['group'], group)
示例6: test_alias_redirection
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_alias_redirection(self):
user = UserFactory.create(userprofile={"is_vouched": True})
group = GroupFactory.create()
group_alias = GroupAliasFactory.create(alias=group)
url = reverse("groups:show_group", kwargs={"url": group_alias.url})
with self.login(user) as client:
response = client.get(url, follow=True)
eq_(response.status_code, 200)
eq_(response.context["group"], group)
示例7: test_search_matches_alias
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_search_matches_alias(self):
group_1 = GroupFactory.create(name='lalo', visible=True)
GroupAliasFactory.create(alias=group_1, name='foo')
eq_(set(Group.search('foo')), set([group_1]))
示例8: test_unique_name
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_unique_name(self):
group = GroupFactory.create()
GroupAliasFactory.create(alias=group, name='bar')
group_2 = GroupFactory.build(name='bar')
self.assertRaises(ValidationError, group_2.clean)
示例9: test_name_unique
# 需要导入模块: from mozillians.groups.tests import GroupAliasFactory [as 别名]
# 或者: from mozillians.groups.tests.GroupAliasFactory import create [as 别名]
def test_name_unique(self):
group = GroupFactory.create()
GroupAliasFactory.create(alias=group, name="bar")
form = GroupForm({"name": "bar"})
ok_(not form.is_valid())
ok_("name" in form.errors)