Exemple #1
0
def test_get_parsed_section(monkeypatch, node_section_content,
                            expected_result):

    _set_up(monkeypatch, "node1", None, {})

    multi_host_sections = MultiHostSections()
    multi_host_sections.add_or_get_host_sections(
        "node1", "127.0.0.1", AgentHostSections(sections=node_section_content))

    content = multi_host_sections.get_parsed_section("node1", "127.0.0.1",
                                                     PluginName("parsed"))

    assert expected_result == content,\
           "Section content: Expected '%s' but got '%s'" % (expected_result, content)
Exemple #2
0
def test_get_parsed_section(patch_register, node_section_content,
                            expected_result):

    multi_host_sections = MultiHostSections()
    multi_host_sections.setdefault(
        HostKey("node1", "127.0.0.1", SourceType.HOST),
        AgentHostSections(sections=node_section_content),
    )

    content = multi_host_sections.get_parsed_section(
        HostKey("node1", "127.0.0.1", SourceType.HOST),
        ParsedSectionName("parsed"),
    )

    assert expected_result == content,\
           "Section content: Expected '%s' but got '%s'" % (expected_result, content)
def test_get_parsed_section(monkeypatch, node_section_content,
                            expected_result):

    _set_up(monkeypatch, "node1", None, {})

    multi_host_sections = MultiHostSections()
    multi_host_sections.setdefault_host_sections(
        ("node1", "127.0.0.1", SourceType.HOST),
        AgentHostSections(sections=node_section_content),
    )

    content = multi_host_sections.get_parsed_section(
        ("node1", "127.0.0.1", SourceType.HOST),
        PluginName("parsed"),
    )

    assert expected_result == content,\
           "Section content: Expected '%s' but got '%s'" % (expected_result, content)