コード例 #1
0
def test_tag_config_insert_tag_group_aux_tag_id_conflict(cfg: tags.TagConfig) -> None:
    cfg.aux_tag_list.append(tags.AuxTag(("bla", "BLAAAA")))
    tg = tags.TagGroup(
        (
            "tgid6",
            "Topics/titlor",
            [
                ("bla", "tagid2", []),
            ],
        )
    )
    cfg.insert_tag_group(tg)
    cfg.validate_config()

    with pytest.raises(MKGeneralException, match="is used twice"):
        tg = tags.TagGroup(
            (
                "bla",
                "Topics/titlor",
                [
                    ("tagid2", "tagid2", []),
                ],
            )
        )
        cfg.insert_tag_group(tg)
        cfg.validate_config()
コード例 #2
0
ファイル: test_utils_tags.py プロジェクト: stefan927/checkmk
def test_iadd_tag_config(test_cfg):
    cfg2 = tags.TagConfig()
    cfg2.insert_tag_group(tags.TagGroup(("tgid3", "Topics/titlor", [("tgid3", "tagid3", [])])))
    cfg2.insert_tag_group(tags.TagGroup(("tgid2", "BLAAA", [("tgid2", "tagid2", [])])))
    cfg2.aux_tag_list.append(tags.AuxTag(("blub", "BLUB")))
    cfg2.aux_tag_list.append(tags.AuxTag(("bla", "BLUB")))

    test_cfg += cfg2

    assert len(test_cfg.tag_groups) == 5
    assert test_cfg.tag_groups[0].id == "criticality"
    assert test_cfg.tag_groups[1].id == "networking"
    assert test_cfg.tag_groups[2].id == "none_choice"
    assert test_cfg.tag_groups[3].id == "tgid3"
    assert test_cfg.tag_groups[3].title == "titlor"

    aux_tags = test_cfg.get_aux_tags()
    assert len(aux_tags) == 2
    assert aux_tags[0].id == "bla"
    assert aux_tags[0].title == u"bläää"
    assert aux_tags[1].id == "blub"
コード例 #3
0
ファイル: test_utils_tags.py プロジェクト: Howaner/checkmk
def test_tag_config_insert_tag_group_aux_tag_id_conflict(cfg):
    cfg.aux_tag_list.append(tags.AuxTag(("bla", "BLAAAA")))
    tg = tags.TagGroup(("tgid6", "Topics/titlor", [
        ("bla", "tagid2", []),
    ]))
    cfg.insert_tag_group(tg)
    cfg.validate_config()

    with pytest.raises(MKUserError, match="is used twice"):
        tg = tags.TagGroup(("bla", "Topics/titlor", [
            ("tagid2", "tagid2", []),
        ]))
        cfg.insert_tag_group(tg)
        cfg.validate_config()