Пример #1
0
def mock_context(agent_ssl_cert,
                 agent_properties=None,
                 agent_runtime_properties=None,
                 agent_context=None,
                 **kwargs):

    agent_context = agent_context or {}
    agent_properties = agent_properties or {}
    agent_runtime_properties = agent_runtime_properties or {}

    context = {
        'node_id':
        'test_node',
        'node_name':
        'test_node',
        'blueprint_id':
        'test_blueprint',
        'deployment_id':
        'test_deployment',
        'execution_id':
        'test_execution',
        'rest_token':
        'test_token',
        'properties': {
            'cloudify_agent': agent_properties
        },
        'runtime_properties': {
            'cloudify_agent': agent_runtime_properties
        },
        'managers': [{
            'networks': {
                'default': '127.0.0.1'
            },
            'ca_cert_content': agent_ssl_cert.DUMMY_CERT,
            'hostname': 'cloudify'
        }],
        'brokers': [{
            'networks': {
                'default': '127.0.0.1'
            },
            'ca_cert_content': agent_ssl_cert.DUMMY_CERT
        }],
        'bootstrap_context':
        BootstrapContext(bootstrap_context={'cloudify_agent': agent_context}),
        'tenant': {
            'name': 'default_tenant',
            'rabbitmq_username': '******',
            'rabbitmq_password': '******',
            'rabbitmq_vhost': '/'
        }
    }
    context.update(kwargs)
    context = MockCloudifyContext(**context)
    context.installer = MagicMock()
    context._get_current_object = lambda: context
    return context
Пример #2
0
def mock_context(agent_properties=None,
                 agent_runtime_properties=None,
                 agent_context=None):

    agent_context = agent_context or {}
    agent_properties = agent_properties or {}
    agent_runtime_properties = agent_runtime_properties or {}

    context = MockCloudifyContext(
        node_id='test_node',
        node_name='test_node',
        blueprint_id='test_blueprint',
        deployment_id='test_deployment',
        execution_id='test_execution',
        rest_token='test_token',
        properties={'cloudify_agent': agent_properties},
        runtime_properties={'cloudify_agent': agent_runtime_properties},
        bootstrap_context=BootstrapContext(
            bootstrap_context={'cloudify_agent': agent_context}))
    context.installer = MagicMock()
    context._get_current_object = lambda: context
    return context
Пример #3
0
def mock_context(agent_properties=None,
                 agent_runtime_properties=None,
                 agent_context=None):

    if not agent_properties:
        agent_properties = {}
    if not agent_runtime_properties:
        agent_runtime_properties = {}

    context = MockCloudifyContext(
        node_id='test_node',
        node_name='test_node',
        blueprint_id='test_blueprint',
        deployment_id='test_deployment',
        execution_id='test_execution',
        properties={'cloudify_agent': agent_properties},
        runtime_properties={'cloudify_agent': agent_runtime_properties},
        bootstrap_context=BootstrapContext(
            bootstrap_context={'cloudify_agent': agent_context})
    )
    context.installer = MagicMock()
    context._get_current_object = lambda: context
    return context