| 1 |
from sarif import * |
| 2 |
|
| 3 |
import pytest |
| 4 |
|
| 5 |
@pytest.fixture(scope='function', autouse=True) |
| 6 |
def sarif(): |
| 7 |
return sarif_from_env() |
| 8 |
|
| 9 |
def test_basics(sarif): |
| 10 |
schema = sarif['$schema'] |
| 11 |
assert schema == "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json" |
| 12 |
|
| 13 |
version = sarif['version'] |
| 14 |
assert version == "2.1.0" |
| 15 |
|
| 16 |
def test_execution_successful(sarif): |
| 17 |
runs = sarif['runs'] |
| 18 |
run = runs[0] |
| 19 |
|
| 20 |
invocations = run['invocations'] |
| 21 |
assert len(invocations) == 1 |
| 22 |
invocation = invocations[0] |
| 23 |
|
| 24 |
assert invocation['executionSuccessful'] == True |
| 25 |
assert invocation['toolExecutionNotifications'] == [] |
| 26 |
|
| 27 |
def test_empty_results(sarif): |
| 28 |
runs = sarif['runs'] |
| 29 |
run = runs[0] |
| 30 |
results = run['results'] |
| 31 |
assert len(results) == 0 |