def test_ValidationResultsTableContentBlockRenderer_get_status_cell(
    evr_failed_with_exception, evr_success, evr_failed
):
    # test for failed evr with exception
    output_1 = ValidationResultsTableContentBlockRenderer._get_status_icon(
        evr_failed_with_exception
    )
    assert output_1.to_json_dict() == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {"icon": "", "markdown_status_icon": "❗"},
            "styling": {
                "params": {
                    "icon": {
                        "classes": ["fas", "fa-exclamation-triangle", "text-warning"],
                        "tag": "i",
                    }
                }
            },
        },
    }

    # test for succeeded evr
    output_2 = ValidationResultsTableContentBlockRenderer._get_status_icon(evr_success)
    assert output_2.to_json_dict() == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {"icon": "", "markdown_status_icon": "✅"},
            "styling": {
                "params": {
                    "icon": {
                        "classes": ["fas", "fa-check-circle", "text-success"],
                        "tag": "i",
                    }
                }
            },
        },
        "styling": {"parent": {"classes": ["hide-succeeded-validation-target-child"]}},
    }

    # test for failed evr
    output_3 = ValidationResultsTableContentBlockRenderer._get_status_icon(evr_failed)
    assert output_3.to_json_dict() == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {"icon": "", "markdown_status_icon": "❌"},
            "styling": {
                "params": {
                    "icon": {"tag": "i", "classes": ["fas", "fa-times", "text-danger"]}
                }
            },
        },
    }
示例#2
0
def test_ValidationResultsTableContentBlockRenderer_get_status_cell(
        evr_failed_with_exception, evr_success, evr_failed):
    # test for failed evr with exception
    output_1 = ValidationResultsTableContentBlockRenderer._get_status_icon(
        evr_failed_with_exception)
    print(json.dumps(output_1, indent=2))
    assert output_1 == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {
                "icon": ""
            },
            "styling": {
                "params": {
                    "icon": {
                        "classes":
                        ["fas", "fa-exclamation-triangle", "text-warning"],
                        "tag":
                        "i"
                    }
                }
            }
        }
    }

    # test for succeeded evr
    output_2 = ValidationResultsTableContentBlockRenderer._get_status_icon(
        evr_success)
    print(json.dumps(output_2, indent=2))
    assert output_2 == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {
                "icon": ""
            },
            "styling": {
                "params": {
                    "icon": {
                        "classes": ["fas", "fa-check-circle", "text-success"],
                        "tag": "i"
                    }
                }
            }
        },
        "styling": {
            "parent": {
                "classes": ["hide-succeeded-validation-target-child"]
            }
        }
    }

    # test for failed evr
    output_3 = ValidationResultsTableContentBlockRenderer._get_status_icon(
        evr_failed)
    print(json.dumps(output_3, indent=2))
    assert output_3 == {
        "content_block_type": "string_template",
        "string_template": {
            "template": "$icon",
            "params": {
                "icon": ""
            },
            "styling": {
                "params": {
                    "icon": {
                        "tag": "i",
                        "classes": ["fas", "fa-times", "text-danger"]
                    }
                }
            }
        }
    }