Пример #1
0
 async def _get_branch_protection_conditions(
     ctxt: context.Context, ) -> typing.List[filter.Filter]:
     return [
         rules.RuleCondition(f"check-success={check}")
         for check in await ctxt.repository.get_branch_protection_checks(
             ctxt.pull["base"]["ref"])
     ]
Пример #2
0
 async def _get_branch_protection_conditions(
     ctxt: context.Context, ) -> typing.List[filter.Filter]:
     branch = await ctxt.repository.get_branch(ctxt.pull["base"]["ref"])
     if not branch["protection"]["enabled"]:
         return []
     return [
         rules.RuleCondition(f"check-success={check}") for check in
         branch["protection"]["required_status_checks"]["contexts"]
     ]
Пример #3
0
def test_invalid_condition_re():
    with pytest.raises(voluptuous.Invalid):
        rules.RuleCondition("head~=(bar")
Пример #4
0
def test_valid_condition():
    c = rules.RuleCondition("head~=bar")
    assert str(c) == "head~=bar"