Ejemplo n.º 1
0
 def setUp(self):
     super(PolicyFileTestCase, self).setUp()
     # since is_admin is defined by policy, create context before reset
     self.context = context.RequestContext('fake', 'fake')
     policy.reset()
     self.target = {}
     self.addCleanup(policy.reset)
Ejemplo n.º 2
0
    def setUp(self):
        super(DefaultPolicyTestCase, self).setUp()
        policy.reset()
        policy.init()

        self.rules = {
            "default": [],
            "example:exist": [["false:false"]]
        }

        self._set_brain('default')

        self.context = context.RequestContext('fake', 'fake')
Ejemplo n.º 3
0
    def setUp(self):
        super(DefaultPolicyTestCase, self).setUp()
        policy.reset()
        policy.init()

        self.rules = {
            "default": [],
            "example:exist": [["false:false"]]
        }

        self._set_brain('default')

        self.context = context.RequestContext('fake', 'fake')
 def setUp(self):
     super(PolicyTestCase, self).setUp()
     policy.reset()
     # NOTE(vish): preload rules to circumvent reloading from file
     policy.init()
     rules = {
         "true": [],
         "example:allowed": [],
         "example:denied": [["false:false"]],
         "example:get_http": [["http:http://www.example.com"]],
         "example:my_file": [["role:compute_admin"],
                             ["project_id:%(project_id)s"]],
         "example:early_and_fail": [["false:false", "rule:true"]],
         "example:early_or_success": [["rule:true"], ["false:false"]],
         "example:lowercase_admin": [["role:admin"], ["role:sysadmin"]],
         "example:uppercase_admin": [["role:ADMIN"], ["role:sysadmin"]],
     }
     # NOTE(vish): then overload underlying brain
     common_policy.set_brain(common_policy.Brain(rules))
     self.context = context.RequestContext('fake', 'fake', roles=['member'])
     self.target = {}
Ejemplo n.º 5
0
 def setUp(self):
     super(PolicyTestCase, self).setUp()
     policy.reset()
     # NOTE(vish): preload rules to circumvent reloading from file
     policy.init()
     rules = {
         "true": [],
         "example:allowed": [],
         "example:denied": [["false:false"]],
         "example:get_http": [["http:http://www.example.com"]],
         "example:my_file": [["role:compute_admin"],
                             ["project_id:%(project_id)s"]],
         "example:early_and_fail": [["false:false", "rule:true"]],
         "example:early_or_success": [["rule:true"], ["false:false"]],
         "example:lowercase_admin": [["role:admin"], ["role:sysadmin"]],
         "example:uppercase_admin": [["role:ADMIN"], ["role:sysadmin"]],
     }
     # NOTE(vish): then overload underlying brain
     common_policy.set_brain(common_policy.Brain(rules))
     self.context = context.RequestContext('fake', 'fake', roles=['member'])
     self.target = {}
Ejemplo n.º 6
0
def reset():
    global _POLICY_PATH
    global _POLICY_CACHE
    _POLICY_PATH = None
    _POLICY_CACHE = {}
    policy.reset()
Ejemplo n.º 7
0
def reset():
    global _POLICY_PATH
    global _POLICY_CACHE
    _POLICY_PATH = None
    _POLICY_CACHE = {}
    policy.reset()
 def tearDown(self):
     policy.reset()
     super(PolicyTestCase, self).tearDown()
 def tearDown(self):
     super(PolicyFileTestCase, self).tearDown()
     policy.reset()
 def setUp(self):
     super(PolicyFileTestCase, self).setUp()
     # since is_admin is defined by policy, create context before reset
     self.context = context.RequestContext('fake', 'fake')
     policy.reset()
     self.target = {}
 def setUp(self):
     super(ContextIsAdminPolicyTestCase, self).setUp()
     policy.reset()
     policy.init()
 def tearDown(self):
     super(DefaultPolicyTestCase, self).tearDown()
     policy.reset()
Ejemplo n.º 13
0
 def setUp(self):
     super(ContextIsAdminPolicyTestCase, self).setUp()
     policy.reset()
     policy.init()
Ejemplo n.º 14
0
 def tearDown(self):
     policy.reset()
     super(PolicyTestCase, self).tearDown()
Ejemplo n.º 15
0
 def tearDown(self):
     super(PolicyFileTestCase, self).tearDown()
     policy.reset()
Ejemplo n.º 16
0
 def tearDown(self):
     super(DefaultPolicyTestCase, self).tearDown()
     policy.reset()