def DuplicateTitleJinja2(v: typing.Any) -> typing.Optional[str]: return types.Jinja2( v, { "destination_branch": "whatever", }, )
def DuplicateTitleJinja2(v): return types.Jinja2( v, { "destination_branch": "whatever", }, )
def DuplicateBodyJinja2(v): return types.Jinja2( v, { "destination_branch": "whatever", "cherry_pick_error": "whaever", }, )
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'." )
def DuplicateBodyJinja2(v: typing.Any) -> typing.Optional[str]: return types.Jinja2( v, { "destination_branch": "whatever", "cherry_pick_error": "whaever", }, )
def CheckRunJinja2(v): return types.Jinja2( v, { "check_rule_name": "whatever", "check_succeed": True, "check_conditions": "the expected condition conditions", }, )
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", }, )
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"
def test_jinja2_custom_attr(): s = "{{ role_status }}" assert types.Jinja2(s, {"role_status": "passed"}) == s
def test_jinja2_None(): with pytest.raises(voluptuous.Invalid) as x: types.Jinja2(None) assert str(x.value) == "Template cannot be null"
def test_jinja2_valid(s): assert types.Jinja2(s) == s
def test_jinja2_valid(s): assert types.Jinja2(s) == s assert types.Jinja2WithNone(s) == s
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