コード例 #1
0
def DuplicateTitleJinja2(v: typing.Any) -> typing.Optional[str]:
    return types.Jinja2(
        v,
        {
            "destination_branch": "whatever",
        },
    )
コード例 #2
0
def DuplicateTitleJinja2(v):
    return types.Jinja2(
        v,
        {
            "destination_branch": "whatever",
        },
    )
コード例 #3
0
def DuplicateBodyJinja2(v):
    return types.Jinja2(
        v,
        {
            "destination_branch": "whatever",
            "cherry_pick_error": "whaever",
        },
    )
コード例 #4
0
ファイル: test_types.py プロジェクト: napetrov/mergify-engine
def test_jinja2_invalid():
    with pytest.raises(voluptuous.Invalid) as x:
        types.Jinja2("{{foo")
    assert str(x.value) == "Template syntax error @ data[line 1]"
    assert (
        str(x.value.error_message)
        == "unexpected end of template, expected 'end of print statement'."
    )
コード例 #5
0
def DuplicateBodyJinja2(v: typing.Any) -> typing.Optional[str]:
    return types.Jinja2(
        v,
        {
            "destination_branch": "whatever",
            "cherry_pick_error": "whaever",
        },
    )
コード例 #6
0
def CheckRunJinja2(v):
    return types.Jinja2(
        v,
        {
            "check_rule_name": "whatever",
            "check_succeed": True,
            "check_conditions": "the expected condition conditions",
        },
    )
コード例 #7
0
def CheckRunJinja2(v: typing.Any) -> typing.Optional[str]:
    return types.Jinja2(
        v,
        {
            "check_rule_name": "whatever",
            "check_succeed": True,
            "check_conditions": "the expected condition conditions",
        },
    )
コード例 #8
0
def test_jinja2_unknown_attr():
    with pytest.raises(voluptuous.Invalid) as x:
        types.Jinja2("{{foo}}")
    assert str(x.value) == "Template syntax error"
    assert str(x.value.error_message) == "Unknown pull request attribute: foo"

    with pytest.raises(voluptuous.Invalid) as x:
        types.Jinja2WithNone("{{foo}}")
    assert str(x.value) == "Template syntax error"
    assert str(x.value.error_message) == "Unknown pull request attribute: foo"
コード例 #9
0
ファイル: test_types.py プロジェクト: napetrov/mergify-engine
def test_jinja2_custom_attr():
    s = "{{ role_status }}"
    assert types.Jinja2(s, {"role_status": "passed"}) == s
コード例 #10
0
ファイル: test_types.py プロジェクト: napetrov/mergify-engine
def test_jinja2_None():
    with pytest.raises(voluptuous.Invalid) as x:
        types.Jinja2(None)
    assert str(x.value) == "Template cannot be null"
コード例 #11
0
ファイル: test_types.py プロジェクト: napetrov/mergify-engine
def test_jinja2_valid(s):
    assert types.Jinja2(s) == s
コード例 #12
0
def test_jinja2_valid(s):
    assert types.Jinja2(s) == s

    assert types.Jinja2WithNone(s) == s
コード例 #13
0
def test_jinja2_not_str():
    with pytest.raises(voluptuous.Invalid) as x:
        types.Jinja2({"title": None})
    assert str(x.value) == "Template must be a string"

    assert types.Jinja2WithNone(None) is None