Example #1
0
 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]))
Example #2
0
 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]))
Example #3
0
 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]))
 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]))
Example #5
0
 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)
Example #6
0
 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'])
Example #7
0
 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'])
Example #8
0
 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'])
Example #9
0
 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)
Example #10
0
 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)
 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)
Example #12
0
 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]))
Example #13
0
 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)
Example #14
0
 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)
Example #15
0
 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)
Example #16
0
 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)