Skip to content

Commit de9a4bc

Browse files
committed
unit tests
1 parent a0da1e0 commit de9a4bc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test/cli/helloworld_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,17 @@ def test_sarif():
373373
assert res['runs'][0]['results'][0]['ruleId'] == 'zerodiv'
374374
assert res['runs'][0]['tool']['driver']['rules'][0]['id'] == 'zerodiv'
375375
assert res['runs'][0]['tool']['driver']['rules'][0]['properties']['precision'] == 'high'
376-
assert res['runs'][0]['tool']['driver']['rules'][0]['properties']['security-severity'] > 9.5
376+
# Test that security-severity is now a string and has the expected value
377+
assert res['runs'][0]['tool']['driver']['rules'][0]['properties']['security-severity'] == '8.500000'
377378
assert 'security' in res['runs'][0]['tool']['driver']['rules'][0]['properties']['tags']
378379
assert re.match(r'[0-9]+(.[0-9]+)+', res['runs'][0]['tool']['driver']['semanticVersion'])
379380
assert 'level' in res['runs'][0]['tool']['driver']['rules'][0]['defaultConfiguration'] # #13885
381+
# Test that rule description is now the generic mapped description, not instance-specific
382+
assert res['runs'][0]['tool']['driver']['rules'][0]['shortDescription']['text'] == 'Division by zero'
383+
# Test that the result message is still the instance-specific message
384+
assert res['runs'][0]['results'][0]['message']['text'] == 'Division by zero.'
385+
# Test that problem.severity property exists and is correct
386+
assert res['runs'][0]['tool']['driver']['rules'][0]['properties']['problem.severity'] == 'error'
380387

381388

382389
def test_xml_checkers_report():

0 commit comments

Comments
 (0)