Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
CMFCore.tests.test_PortalContent.TestContentCopyPaste Class Reference
Inheritance diagram for CMFCore.tests.test_PortalContent.TestContentCopyPaste:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_PortalContent.TestContentCopyPaste:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_CopyPasteSetsOwnership

Public Attributes

 site
 acl_users

Static Public Attributes

 layer = TraversingEventZCMLLayer

Private Member Functions

def _initContent

Detailed Description

Definition at line 97 of file test_PortalContent.py.


Member Function Documentation

def CMFCore.tests.test_PortalContent.TestContentCopyPaste._initContent (   self,
  folder,
  id 
) [private]

Definition at line 111 of file test_PortalContent.py.

00111 
00112     def _initContent(self, folder, id):
00113         from Products.CMFCore.PortalContent import PortalContent
00114 
00115         c = PortalContent()
00116         c._setId(id)
00117         c.meta_type = 'File'
00118         folder._setObject(id, c)
00119         return folder._getOb(id)

Here is the caller graph for this function:

Definition at line 104 of file test_PortalContent.py.

00104 
00105     def setUp(self):
00106         SecurityRequestTest.setUp(self)
00107 
00108         self.root._setObject('site', DummySite('site'))
00109         self.site = self.root.site
00110         self.acl_users = self.site._setObject('acl_users', DummyUserFolder())

Definition at line 120 of file test_PortalContent.py.

00120 
00121     def test_CopyPasteSetsOwnership(self):
00122         # Copy/pasting a File should set new ownership including local roles
00123         from OFS.Folder import Folder
00124 
00125         acl_users = self.acl_users
00126         folder1 = self.site._setObject('folder1', Folder('folder1'))
00127         folder2 = self.site._setObject('folder2', Folder('folder2'))
00128 
00129         newSecurityManager(None, acl_users.user_foo)
00130         content = self._initContent(folder1, 'content')
00131         content.manage_setLocalRoles(acl_users.user_foo.getId(), ['Owner'])
00132 
00133         newSecurityManager(None, acl_users.all_powerful_Oz)
00134         cb = folder1.manage_copyObjects(['content'])
00135         folder2.manage_pasteObjects(cb)
00136 
00137         # Now test executable ownership and "owner" local role
00138         # "member" should have both.
00139         moved = folder2._getOb('content')
00140         self.assertEqual(aq_base(moved.getOwner()),
00141                          aq_base(acl_users.all_powerful_Oz))
00142 
00143         local_roles = moved.get_local_roles()
00144         self.assertEqual(len(local_roles), 1)
00145         userid, roles = local_roles[0]
00146         self.assertEqual(userid, acl_users.all_powerful_Oz.getId())
00147         self.assertEqual(len(roles), 1)
00148         self.assertEqual(roles[0], 'Owner')
00149 

Here is the call graph for this function:


Member Data Documentation

Definition at line 109 of file test_PortalContent.py.

Definition at line 102 of file test_PortalContent.py.

Definition at line 108 of file test_PortalContent.py.


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