コード例 #1
0
 def mock_ctx(self,
              test_vars,
              test_id,
              test_deployment_id,
              runtime_properties=None):
     ctx = MockContext()
     ctx.node = MockNodeContext(properties=test_vars)
     ctx.bootstrap_context = BootstrapContext(
         common_test.BOOTSTRAP_CONTEXTS_WITHOUT_PREFIX[0])
     ctx.instance = MockNodeInstanceContext(
         id=test_id, runtime_properties=runtime_properties or {})
     ctx.deployment = mock.Mock()
     ctx.deployment.id = test_deployment_id
     ctx.type = NODE_INSTANCE
     ctx.logger = mock.Mock()
     return ctx
コード例 #2
0
    def mock_ctx(self,
                 test_vars,
                 test_id,
                 test_deployment_id,
                 runtime_properties=None):

        ctx = MockContext()
        ctx.node = MockNodeContext(properties=test_vars)
        ctx.instance = MockNodeInstanceContext(
            id=test_id, runtime_properties=runtime_properties or {})
        ctx.deployment = mock.Mock()
        ctx.deployment.id = test_deployment_id
        ctx.bootstrap_context = mock.Mock()
        setattr(ctx.bootstrap_context, 'resources_prefix', '')
        ctx.type = NODE_INSTANCE
        ctx.logger = mock.Mock()

        return ctx