def test_delete_node_role_dimension():
    try:
        network_name = 'n1'
        bf_set_network(network_name)
        dim_name = 'd1'
        dim = NodeRoleDimension(dim_name)
        bf_add_node_role_dimension(dim)
        # should not crash
        bf_get_node_role_dimension(dim_name)
        bf_delete_node_role_dimension(dim_name)
        # dimension should no longer exist
        with raises(HTTPError, match='404'):
            bf_get_node_role_dimension(dim_name)
        # second delete should fail
        with raises(HTTPError, match='404'):
            bf_delete_node_role_dimension(dim_name)

    finally:
        bf_delete_network(network_name)
Esempio n. 2
0
def test_delete_node_role_dimension(session):
    try:
        network_name = "n1"
        bf_set_network(network_name)
        dim_name = "d1"
        mapping = RoleDimensionMapping(regex="(regex)")
        dim = NodeRoleDimension(name=dim_name, roleDimensionMappings=[mapping])
        bf_add_node_role_dimension(dim)
        # should not crash
        bf_get_node_role_dimension(dim_name)
        bf_delete_node_role_dimension(dim_name)
        # dimension should no longer exist
        with raises(HTTPError, match="404"):
            bf_get_node_role_dimension(dim_name)
        # second delete should fail
        with raises(HTTPError, match="404"):
            bf_delete_node_role_dimension(dim_name)

    finally:
        bf_delete_network(network_name)