'Test update/delete of a controller ACL'

def testUpdateControllerACL(self):

    auth = current.auth
    table = auth.permission.table
    self.assertNotEqual(table, None)
    group_id = auth.s3_create_role('Test    Role', uid='TEST')
    acl_id = None
    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertTrue = self.assertTrue
    assertFalse = self.assertFalse
    try:
        assertTrue(((group_id is not None) and (group_id != 0)))
        c = 'pr'
        f = 'person'
        uacl = auth.permission.NONE
        oacl = auth.permission.ALL
        acl_id = auth.permission.update_acl(group_id, c=c, f=f, uacl=uacl, oacl=oacl)
        assertNotEqual(acl_id, None)
        assertNotEqual(acl_id, 0)
        acl = table[acl_id]
        assertNotEqual(acl, None)
        assertEqual(acl.controller, c)
        assertEqual(acl.function, f)
        assertEqual(acl.tablename, None)
        assertEqual(acl.unrestricted, False)
        assertEqual(acl.entity, None)
        assertEqual(acl.uacl, uacl)
        assertEqual(acl.oacl, oacl)
        assertFalse(acl.deleted)
        success = auth.permission.delete_acl(group_id, c=c, f=f)
        assertTrue(((success is not None) and (success > 0)))
        acl = table[acl_id]
        assertNotEqual(acl, None)
        assertTrue(acl.deleted)
        assertTrue(acl.deleted_fk, ('{"group_id":    %d}' % group_id))
    finally:
        if acl_id:
            del table[acl_id]
        auth.s3_delete_role(group_id)
