def test_empty_context(self): ctx = context.ActionContext(context.SecurityContext(), context.ExecutionContext()) self.assertIsInstance(ctx.security, context.SecurityContext) self.assertIsInstance(ctx.execution, context.ExecutionContext) self.assertEqual(ctx.security.auth_uri, None) self.assertEqual(ctx.execution.workflow_name, None)
def _fake_context(): security_ctx = context.SecurityContext(auth_uri='auth_uri', auth_cacert='auth_cacert', insecure='insecure', service_catalog='service_catalog', region_name='region_name', is_trust_scoped='is_trust_scoped', redelivered='redelivered', expires_at='expires_at', trust_id='trust_id', is_target='is_target', project_id='project_id') execution_ctx = context.ExecutionContext( workflow_execution_id='workflow_execution_id', task_execution_id='task_execution_id', action_execution_id='action_execution_id', workflow_name='workflow_name', callback_url='callback_url') ctx = context.ActionContext(security_ctx, execution_ctx) return ctx
def create_action_context(execution_ctx): context = ctx() security_ctx = lib_ctx.SecurityContext( auth_cacert=context.auth_cacert, auth_token=context.auth_token, auth_uri=context.auth_uri, expires_at=context.expires_at, insecure=context.insecure, is_target=context.is_target, is_trust_scoped=context.is_trust_scoped, project_id=context.project_id, project_name=context.project_name, user_name=context.user_name, redelivered=context.redelivered, region_name=context.region_name, service_catalog=context.service_catalog, trust_id=context.trust_id, ) ex_ctx = lib_ctx.ExecutionContext(**execution_ctx) return lib_ctx.ActionContext(security_ctx, ex_ctx)