Commit 5b00ec3f authored by Zachery Bir's avatar Zachery Bir

- remove unnecessary additional complexity from the FauxUser (we

    don't test any of that here.)

  - include a test suite declaration

  - slight clarification on some of the test names and content ids
parent f75cd739
...@@ -25,44 +25,11 @@ class FauxUser( Implicit ): ...@@ -25,44 +25,11 @@ class FauxUser( Implicit ):
self._id = id self._id = id
self._login = login self._login = login
self._roles = {}
self._groups = {}
def getId( self ): def getId( self ):
return self._id return self._id
def getUserName( self ):
return self._login
def getRoles( self ):
return self._roles
def getGroups( self ):
return self._groups
def allowed( self, value, roles ):
return 1
def _addRoles( self, roles ):
for role in roles:
self._roles[role] = 1
def _addGroups(self, groups):
for group in groups:
self._groups[group] = 1
def __repr__( self ):
return '<FauxUser: %s>' % self._id
class ObjectManagerTests( unittest.TestCase ): class ObjectManagerTests( unittest.TestCase ):
def tearDown( self ): def tearDown( self ):
...@@ -132,7 +99,7 @@ class ObjectManagerTests( unittest.TestCase ): ...@@ -132,7 +99,7 @@ class ObjectManagerTests( unittest.TestCase ):
self.assertEqual( si.__ac_local_roles__, None ) self.assertEqual( si.__ac_local_roles__, None )
def test_setObject_set_owner_with_simple_user( self ): def test_setObject_set_owner_with_user( self ):
om = self._makeOne() om = self._makeOne()
...@@ -140,11 +107,11 @@ class ObjectManagerTests( unittest.TestCase ): ...@@ -140,11 +107,11 @@ class ObjectManagerTests( unittest.TestCase ):
newSecurityManager( None, user ) newSecurityManager( None, user )
si = SimpleItem( 'faux_creation' ) si = SimpleItem( 'user_creation' )
self.assertEqual( si.__ac_local_roles__, None ) self.assertEqual( si.__ac_local_roles__, None )
om._setObject( 'faux_creation', si ) om._setObject( 'user_creation', si )
self.assertEqual( si.__ac_local_roles__, { 'user': ['Owner'] } ) self.assertEqual( si.__ac_local_roles__, { 'user': ['Owner'] } )
...@@ -252,5 +219,10 @@ class ObjectManagerTests( unittest.TestCase ): ...@@ -252,5 +219,10 @@ class ObjectManagerTests( unittest.TestCase ):
self.assertEqual( si.__ac_local_roles__, None ) self.assertEqual( si.__ac_local_roles__, None )
def test_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite( ObjectManagerTests ) )
return suite
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
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