allow pytest to work from root or wait-for-ecr-scan-and-get-sarif

This commit is contained in:
burnettk 2024-08-15 08:52:47 -04:00
parent 11e961b3d0
commit b889ea329a
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -1,9 +1,14 @@
import json import json
import pytest import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from aws_scan_findings_to_sarif import convert_to_sarif from aws_scan_findings_to_sarif import convert_to_sarif
def test_convert_to_sarif(): def test_convert_to_sarif():
with open("sample-api-response-ecr-describe-image-scan-findings.json", "r") as f: base_dir = os.path.dirname(os.path.abspath(__file__))
sample_file_path = os.path.join(base_dir, "sample-api-response-ecr-describe-image-scan-findings.json")
with open(sample_file_path, "r") as f:
ecr_response = json.load(f) ecr_response = json.load(f)
sarif_report = convert_to_sarif(ecr_response) sarif_report = convert_to_sarif(ecr_response)