def __init__(self, user=None, project_id=None, is_admin=False, **kwargs): if project_id: kwargs['tenant'] = project_id super(Context, self).__init__(is_admin=is_admin, **kwargs) self.policy = policy.Policy(self)
def test__check_yaml_policy(self): policy.Policy() self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF)) self.conf.config(group='oslo_policy', policy_file='test.yaml') check_result = self.cmd._check_yaml_policy() self.assertEqual(Code.SUCCESS, check_result.code) self.conf.config(group='oslo_policy', policy_file='test.json') check_result = self.cmd._check_yaml_policy() self.assertEqual(Code.WARNING, check_result.code) self.conf.config(group='oslo_policy', policy_file='test') check_result = self.cmd._check_yaml_policy() self.assertEqual(Code.FAILURE, check_result.code)
def main(): policy.Policy() return upgradecheck.main( CONF, project='octavia', upgrade_command=Checks())