Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
PlonePAS.tests.test_groups_tool.GroupsToolTest Class Reference
Inheritance diagram for PlonePAS.tests.test_groups_tool.GroupsToolTest:
Inheritance graph
[legend]
Collaboration diagram for PlonePAS.tests.test_groups_tool.GroupsToolTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_get_group
def test_get_group_by_id
def test_edit_group

Public Attributes

 gt
 gd
 group_id

Detailed Description

Definition at line 32 of file test_groups_tool.py.


Member Function Documentation

Definition at line 34 of file test_groups_tool.py.

00034 
00035     def afterSetUp(self):
00036         self.gt = gt = getToolByName(self.portal, 'portal_groups')
00037         self.gd = gd = getToolByName(self.portal, 'portal_groupdata')
00038 
00039         self.group_id = 'group1'
00040         # Create a new Group
00041         self.loginAsPortalOwner()
00042         gt.addGroup(self.group_id, ['Reviewer'], [],
00043                     {'email': 'group1@host.com',
00044                      'title': 'Group #1'})

Definition at line 66 of file test_groups_tool.py.

00066 
00067     def test_edit_group(self):
00068         # Use the tool way to edit a group.
00069         properties = {
00070             'email': 'group1@host2.com',
00071             'title': 'Group #1 new title'
00072         }
00073         self.gt.editGroup(self.group_id, roles=['Manager'],
00074             **properties)
00075 
00076         # test edition of roles and properties
00077         group = self.gt.getGroupById(self.group_id)
00078         self.failUnless(group.has_role('Manager'))
00079         self.assertEqual(group.getProperty('email'), properties['email'])
00080         self.assertEqual(group.getProperty('title'), properties['title'])
00081 
00082         # test for empty list of roles
00083         self.gt.editGroup(self.group_id, roles=[])
00084         self.failUnless(group.has_role('Authenticated'))

Definition at line 45 of file test_groups_tool.py.

00045 
00046     def test_get_group(self):
00047         # Use PAS (monkeypatched) API method to get a group by id.
00048         group = self.portal.acl_users.getGroup(self.group_id)
00049         self.failIf(group is None)
00050 
00051         # Should be wrapped into the GroupManagement, which is wrapped
00052         # into the PAS.
00053         got = aq_base(aq_parent(aq_parent(group)))
00054         expected = aq_base(self.portal.acl_users)
00055         self.assertEquals(got, expected)
00056 
00057         self.failUnless(isinstance(group, PloneGroup))

Definition at line 58 of file test_groups_tool.py.

00058 
00059     def test_get_group_by_id(self):
00060         # Use tool way of getting group by id. This returns a
00061         # GroupData object wrapped by the group
00062         group = self.gt.getGroupById(self.group_id)
00063         self.failIf(group is None)
00064         self.failUnless(isinstance(group, GroupData))
00065         self.failUnless(isinstance(aq_parent(group), PloneGroup))


Member Data Documentation

Definition at line 36 of file test_groups_tool.py.

Definition at line 38 of file test_groups_tool.py.

Definition at line 35 of file test_groups_tool.py.


The documentation for this class was generated from the following file: