diff --git a/tests/test_result.py b/tests/test_result.py index b7ce118..334e666 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -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()