コード例 #1
0
def test_model_add_lower_level_deployment_node(empty_model: Model):
    """Make sure child deployment nodes are not reflected in Model.deployent_nodes."""
    node1 = empty_model.add_deployment_node(name="node1")
    node2 = DeploymentNode(name="node2", parent=node1)
    empty_model += node2
    assert node2 not in empty_model.deployment_nodes
    assert node2 in empty_model.get_elements()
コード例 #2
0
def test_model_cant_add_two_deployment_nodes_with_same_name(empty_model: Model):
    """Make sure that deployment nodes at the top level can't have the same name.

    Unless they're in different environments.
    """
    empty_model.add_deployment_node(name="node1", environment="Live")
    empty_model.add_deployment_node(name="node1", environment="Dev")  # Different env
    with pytest.raises(
        ValueError,
        match="A deployment node with the name 'node1' already "
        "exists in environment 'Live' of the model.",
    ):
        empty_model.add_deployment_node(name="node1", environment="Live")
コード例 #3
0
def test_model_add_top_level_deployment_node(empty_model: Model):
    """Make sure top-level deployment nodes are reflected in Model.deployent_nodes."""
    node = empty_model.add_deployment_node(name="node1")
    assert node is not None
    assert node in empty_model.deployment_nodes
    assert node in empty_model.get_elements()