def test_ParentChildTopologyPage_get_default_view_hostnames(
    rough_livestatus: MockLiveStatusConnection, ) -> None:
    rough_livestatus.expect_query(
        "GET hosts\nColumns: name\nFilter: parents =")
    with rough_livestatus(expect_status_query=True):
        page = ParentChildTopologyPage()
        result_set = page._get_default_view_hostnames(max_nodes=2)
    assert result_set.pop() == "bar<(/"
def test_ParentChildTopologyPage_get_hostnames_from_filters(
        rough_livestatus: MockLiveStatusConnection, mocker) -> None:
    rough_livestatus.expect_query("GET hosts\nColumns: name")

    class MockView:
        context = None

    mocker.patch(
        "cmk.gui.node_visualization.get_topology_view_and_filters",
        return_value=(MockView, []),
    )
    mocker.patch(
        "cmk.gui.plugins.visuals.utils.get_livestatus_filter_headers",
        return_value=[],
    )

    with rough_livestatus(expect_status_query=True):
        page = ParentChildTopologyPage()
        result_set = page._get_hostnames_from_filters()
    assert "foo<(/" in result_set