Ejemplo n.º 1
0
 def test_DeletePermission(self):
   # test that a deleted permission is actually gone
   p1 = permissions.create('read')
   p2 = permissions.get('read')
   self.assert_(p1 == p2,"stored permission must be returned")
   permissions.delete(p1)
   p3 = permissions.get('read')
   self.assert_(p3 == None,"deleted permissions should not be returned")
Ejemplo n.º 2
0
 def test_GetPermission(self):
   # test that search for a permission results in the permission being returned
   p1 = permissions.create("read")
   logging.info(p1)
   p5 = permissions.get("read")
   logging.info(p5)
   p2 = permissions.create('write',desc="a writing permission")
   p3 = permissions.create('furgle',p1)
   p4 = permissions.create('nurgle',p2,desc="permission to nurgle p2")
   self.assert_(p1 == permissions.get("read"),"should return the generic read permission")
   self.assert_(p2 == permissions.get('write'),"should return the generic write permission")
   self.assert_(p3 == permissions.get('furgle',obj=p1),"should return the permission to furgle p1")
   self.assert_(p4 == permissions.get('nurgle',obj=p2),"should return the permissions to nurgle p2")
   self.assert_(permissions.get('bingle') == None,"trying to get permissions that dont exist should return None")
   self.assert_(permissions.get('bingle',obj=p1) == None,"trying to get permissions that dont exist should return None")