def setUp(self): super(APITest, self).setUp() pecan_opts = cfg.CONF.pecan self.app = pecan.testing.load_test_app({ 'app': { 'root': pecan_opts.root, 'modules': pecan_opts.modules, 'debug': pecan_opts.debug, 'auth_enable': False, 'disable_cron_trigger_thread': True } }) self.addCleanup(pecan.set_config, {}, overwrite=True) self.addCleanup(cfg.CONF.set_default, 'auth_enable', False, group='pecan') # Adding cron trigger thread clean up explicitly in case if # new tests will provide an alternative configuration for pecan # application. self.addCleanup(periodic.stop_all_periodic_tasks) # Make sure the api get the correct context. self.patch_ctx = mock.patch( 'mistral.context.context_from_headers_and_env') self.mock_ctx = self.patch_ctx.start() self.mock_ctx.return_value = self.ctx self.addCleanup(self.patch_ctx.stop) self.policy = self.useFixture(policy_fixtures.PolicyFixture())
def setUp(self): super(TestKeyCloakOIDCAuthScenarios, self).setUp() self.override_config('enabled', False, group='cron_trigger') self.override_config('auth_enable', True, group='pecan') self.override_config('auth_type', 'keycloak-oidc') self.override_config('auth_url', AUTH_URL, group='keycloak_oidc') self.app = pecan.testing.load_test_app( dict(pecan_app.get_pecan_config()) ) # Adding cron trigger thread clean up explicitly in case if # new tests will provide an alternative configuration for pecan # application. self.addCleanup(periodic.stop_all_periodic_tasks) # Make sure the api get the correct context. self.patch_ctx = mock.patch( 'mistral.context.MistralContext.from_environ' ) self.mock_ctx = self.patch_ctx.start() self.mock_ctx.return_value = self.ctx self.addCleanup(self.patch_ctx.stop) self.policy = self.useFixture(policy_fixtures.PolicyFixture())
def setUp(self): super(PolicyTestCase, self).setUp() self.policy = self.useFixture(policy_fixtures.PolicyFixture()) rules = { "admin_only": "is_admin:True", "admin_or_owner": "is_admin:True or project_id:%(project_id)s", "example:admin": "rule:admin_only", "example:admin_or_owner": "rule:admin_or_owner" } self.policy.set_rules(rules)
def setUp(self): super(PolicyTest, self).setUp() self.policy = self.useFixture(policy_fixtures.PolicyFixture()) rules = { "example:admin": "rule:admin_only", "example:admin_or_owner": "rule:admin_or_owner" } self.policy.register_rules(rules)
def setUp(self): super(TestKeyCloakOIDCAuthApp, self).setUp() self.override_config('enabled', False, group='cron_trigger') self.override_config('auth_enable', True, group='pecan') self.override_config('auth_type', 'keycloak-oidc') self.override_config('auth_url', AUTH_URL, group='keycloak_oidc') self.app = pecan.testing.load_test_app( dict(pecan_app.get_pecan_config())) # Adding cron trigger thread clean up explicitly in case if # new tests will provide an alternative configuration for pecan # application. self.addCleanup(periodic.stop_all_periodic_tasks) self.policy = self.useFixture(policy_fixtures.PolicyFixture())
def setUp(self): super(TestKeyCloakOIDCAuthScenarios, self).setUp() cfg.CONF.set_default('auth_enable', True, group='pecan') cfg.CONF.set_default('auth_type', 'keycloak-oidc') cfg.CONF.set_default('auth_url', AUTH_URL, group='keycloak_oidc') pecan_opts = cfg.CONF.pecan self.app = pecan.testing.load_test_app({ 'app': { 'root': pecan_opts.root, 'modules': pecan_opts.modules, 'debug': pecan_opts.debug, 'auth_enable': True, 'disable_cron_trigger_thread': True } }) self.addCleanup(pecan.set_config, {}, overwrite=True) self.addCleanup(cfg.CONF.set_default, 'auth_enable', False, group='pecan') self.addCleanup(cfg.CONF.set_default, 'auth_type', 'keystone') # Adding cron trigger thread clean up explicitly in case if # new tests will provide an alternative configuration for pecan # application. self.addCleanup(periodic.stop_all_periodic_tasks) # Make sure the api get the correct context. self.patch_ctx = mock.patch( 'mistral.context.MistralContext.from_environ') self.mock_ctx = self.patch_ctx.start() self.mock_ctx.return_value = self.ctx self.addCleanup(self.patch_ctx.stop) self.policy = self.useFixture(policy_fixtures.PolicyFixture())
def setUp(self): self.policy = self.useFixture(policy_fixtures.PolicyFixture()) super(TestWorkflowPolicy, self).setUp()
def setUp(self): super(TestActionPolicy, self).setUp() self.policy = self.useFixture(policy_fixtures.PolicyFixture())