예제 #1
0
 def test_group_edit(self):
     # Curator can edit a group and change (some of) its properties
     data = {
         'name': u'Test Group',
         'accepting_new_members': u'by_request',
         'description': u'lorem ipsum and lah-dee-dah',
         'irc_channel': u'some text, this is not validated',
         'website': u'http://mozillians.org',
         'wiki': u'http://wiki.mozillians.org',
         'members_can_leave': True,
         'visible': True,
         'functional_area': False,
     }
     group = GroupFactory(**data)
     # Must be curator or superuser to edit group. Make user the curator.
     group.curator = self.user.userprofile
     group.save()
     url = reverse('groups:group_edit',
                   prefix='/en-US/',
                   kwargs={'url': group.url})
     # Change some data
     data2 = data.copy()
     data2['description'] = u'A new description'
     data2['wiki'] = u'http://google.com/'
     # make like a form
     del data2['functional_area']
     with self.login(self.user) as client:
         response = client.post(url, data=data2, follow=False)
     eq_(302, response.status_code)
     group = GroupAlias.objects.get(name=data['name']).alias
     eq_(data2['description'], group.description)
     ok_(group.visible)
     ok_(group.members_can_leave)
     ok_(not group.functional_area)
예제 #2
0
 def test_group_edit(self):
     # Curator can edit a group and change (some of) its properties
     data = {
         "name": u"Test Group",
         "accepting_new_members": u"by_request",
         "description": u"lorem ipsum and lah-dee-dah",
         "irc_channel": u"some text, this is not validated",
         "website": u"http://mozillians.org",
         "wiki": u"http://wiki.mozillians.org",
         "members_can_leave": True,
         "visible": True,
         "functional_area": False,
     }
     group = GroupFactory(**data)
     # Must be curator or superuser to edit group. Make user the curator.
     group.curator = self.user.userprofile
     group.save()
     url = reverse("groups:group_edit", prefix="/en-US/", kwargs={"url": group.url})
     # Change some data
     data2 = data.copy()
     data2["description"] = u"A new description"
     data2["wiki"] = u"http://google.com/"
     # make like a form
     del data2["functional_area"]
     with self.login(self.user) as client:
         response = client.post(url, data=data2, follow=False)
     eq_(302, response.status_code)
     group = GroupAlias.objects.get(name=data["name"]).alias
     eq_(data2["description"], group.description)
     ok_(group.visible)
     ok_(group.members_can_leave)
     ok_(not group.functional_area)
예제 #3
0
 def test_group_edit(self):
     # Curator can edit a group and change (some of) its properties
     data = {
         'name': u'Test Group',
         'accepting_new_members': u'by_request',
         'description': u'lorem ipsum and lah-dee-dah',
         'irc_channel': u'some text, this is not validated',
         'website': u'http://mozillians.org',
         'wiki': u'http://wiki.mozillians.org',
         'members_can_leave': True,
         'visible': True,
         'functional_area': False,
     }
     group = GroupFactory(**data)
     # Must be curator or superuser to edit group. Make user the curator.
     group.curator = self.user.userprofile
     group.save()
     url = reverse('groups:group_edit', prefix='/en-US/', kwargs={'url': group.url})
     # Change some data
     data2 = data.copy()
     data2['description'] = u'A new description'
     data2['wiki'] = u'http://google.com/'
     # make like a form
     del data2['functional_area']
     with self.login(self.user) as client:
         response = client.post(url, data=data2, follow=False)
     eq_(302, response.status_code)
     group = GroupAlias.objects.get(name=data['name']).alias
     eq_(data2['description'], group.description)
     ok_(group.visible)
     ok_(group.members_can_leave)
     ok_(not group.functional_area)