Exemple #1
0
def test_deploy_no_server_group():
    builder = OperationRequestBuilder()
    builder.target(None)
    builder.deploy()
    request = builder.build()

    assert request == dict(operation='deploy', address=[])
Exemple #2
0
def test_deploy_with_server_group():
    builder = OperationRequestBuilder()
    builder.target('main-server-group')
    builder.deploy()

    request = builder.build()

    assert request == dict(operation='add',
                           address=[{'server-group': 'main-server-group'}])
Exemple #3
0
def deploy(name, src, server_group):
    add_builder = OperationRequestBuilder()
    add_builder.deployment(name)
    add_builder.content(src)
    add_builder.add()
    add_content = add_builder.build()

    deploy_builder = OperationRequestBuilder()
    deploy_builder.target(server_group)
    deploy_builder.deploy()
    deploy_builder.deployment(name)
    deploy_operation = deploy_builder.build()

    return [add_content, deploy_operation]
Exemple #4
0
def test_composite_operation():
    builder = OperationRequestBuilder()
    builder.add()
    add_operation = builder.build()

    builder = OperationRequestBuilder()
    builder.deploy()
    deploy_operation = builder.build()

    builder = OperationRequestBuilder()
    builder.composite([add_operation, deploy_operation])

    request = builder.build()

    assert request == dict(address=[],
                           operation='composite',
                           steps=[add_operation, deploy_operation])