Commit a2de2015 authored by Tres Seaver's avatar Tres Seaver

Remove cruft, wrap long lines, normalize layout.

parent ee09921c
...@@ -11,33 +11,26 @@ ...@@ -11,33 +11,26 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Skeleton ZopeTestCase import unittest
$Id: testSkeleton.py 30245 2005-05-05 09:50:09Z shh $
"""
import os, sys
from Testing import ZopeTestCase from Testing import ZopeTestCase
class TestRecursiveChangeOwnership(ZopeTestCase.ZopeTestCase): class TestRecursiveChangeOwnership(ZopeTestCase.ZopeTestCase):
user_name2 = "dumdidum" user_name2 = "dumdidum"
user_pass2 = "dumdidum" user_pass2 = "dumdidum"
def afterSetUp(self): def afterSetUp(self):
## self.folder.changeOwnership(ZopeTestCase.user_name)
# need a second user # need a second user
ufld = self.folder['acl_users'] ufld = self.folder['acl_users']
ufld.userFolderAddUser(self.user_name2, self.user_pass2, [], []) ufld.userFolderAddUser(self.user_name2, self.user_pass2, [], [])
# remember user objects # remember user objects
# is the __of__() call correct? is it needed? without it ownerInfo in Owned.py throws # is the __of__() call correct? is it needed? without it ownerInfo in
# an AttributeError ... # Owned.py throws an AttributeError ...
self.user1 = self.folder['acl_users'].getUser(ZopeTestCase.user_name).__of__(self.folder) self.user1 = self.folder['acl_users'].getUser(ZopeTestCase.user_name
self.user2 = self.folder['acl_users'].getUser(self.user_name2).__of__(self.folder) ).__of__(self.folder)
self.user2 = self.folder['acl_users'].getUser(self.user_name2
).__of__(self.folder)
self.folder.changeOwnership(self.user1) self.folder.changeOwnership(self.user1)
...@@ -51,25 +44,19 @@ class TestRecursiveChangeOwnership(ZopeTestCase.ZopeTestCase): ...@@ -51,25 +44,19 @@ class TestRecursiveChangeOwnership(ZopeTestCase.ZopeTestCase):
# ensure folder is owned by user1 # ensure folder is owned by user1
owner = self.folder.getOwnerTuple()[1] owner = self.folder.getOwnerTuple()[1]
self.assertEqual(owner, ZopeTestCase.user_name) self.assertEqual(owner, ZopeTestCase.user_name)
# ensure file is owned by user2 # ensure file is owned by user2
owner = self.file.getOwnerTuple()[1] owner = self.file.getOwnerTuple()[1]
self.assertEqual(owner, self.user_name2) self.assertEqual(owner, self.user_name2)
self.folder.changeOwnership(self.user1, recursive=1) self.folder.changeOwnership(self.user1, recursive=1)
# ensure file's ownership has changed now to user1 # ensure file's ownership has changed now to user1
owner = self.file.getOwnerTuple()[1] owner = self.file.getOwnerTuple()[1]
self.assertEqual(owner, ZopeTestCase.user_name) self.assertEqual(owner, ZopeTestCase.user_name)
def test_suite(): def test_suite():
from unittest import TestSuite, makeSuite return unittest.TestSuite((
suite = TestSuite() unittest.makeSuite(TestRecursiveChangeOwnership),
suite.addTest(makeSuite(TestRecursiveChangeOwnership)) ))
return suite
if __name__ == '__main__':
framework()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment