Skip to content

Commit

Permalink
Add extra test for unregistered rule id on issue registration
Browse files Browse the repository at this point in the history
Signed-off-by: patrickpa <[email protected]>
  • Loading branch information
patrickpa committed Jun 10, 2024
1 parent 7767057 commit 84e9737
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,37 @@ def test_result_register_issue_id_generation() -> None:
assert issue_id_0 == issue_id_1 - 1


def test_create_issue_with_unregistered_rule_id() -> None:
result = Result()

result.register_checker_bundle(
name="TestBundle",
build_date="2024-05-31",
description="Example checker bundle",
version="0.0.1",
summary="Tested example checkers",
)

result.register_checker(
checker_bundle_name="TestBundle",
checker_id="TestChecker",
description="Test checker",
summary="Executed evaluation",
)

with pytest.raises(
ValidationError,
match=r".* Issue Rule UID 'test.com:qc:1.0.0:qwerty.qwerty' does not match addressed rules UIDs \[\].*",
) as exc_info:
issue_id_0 = result.register_issue(
checker_bundle_name="TestBundle",
checker_id="TestChecker",
description="Issue found at odr",
level=IssueSeverity.INFORMATION,
rule_uid="test.com:qc:1.0.0:qwerty.qwerty",
)


def test_create_rule_id_validation() -> None:
result = Result()

Expand Down

0 comments on commit 84e9737

Please sign in to comment.