Skip to content

Commit

Permalink
fix(redhat_osv): restructure test data (#308)
Browse files Browse the repository at this point in the history
This commit restructures the test data so that CSAF and OSV data is not
co-mingled in the same directory. It is an attept to address

```
$ go install github.com/ossf/osv-schema/tools/osv-linter@latest
go: downloading github.com/ossf/osv-schema v1.6.7
go: github.com/ossf/osv-schema/tools/osv-linter@latest: create zip: tools/redhat/testdata/rhsa-2024_4546.json: case-insensitive file name collision: "tools/redhat/testdata/RHSA-2024_4546.json" and "tools/redhat/testdata/rhsa-2024_4546.json"
```

---------

Signed-off-by: Andrew Pollock <[email protected]>
  • Loading branch information
andrewpollock authored Nov 5, 2024
1 parent c767f97 commit 4220311
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/redhat/redhat_osv/convert_redhat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def test_convert_redhat(self):
""" Test a single demo CSAF file """
modified_time = datetime.strptime("2024-09-02T14:30:00",
"%Y-%m-%dT%H:%M:%S")
csaf_file = f"testdata/rhsa-{test_advisory}.json"
expected_file = f"testdata/RHSA-{test_advisory}.json"
csaf_file = f"testdata/CSAF/rhsa-{test_advisory}.json"
expected_file = f"testdata/OSV/RHSA-{test_advisory}.json"

with open(csaf_file, "r", encoding="utf-8") as fp:
csaf_data = fp.read()
Expand Down
3 changes: 2 additions & 1 deletion tools/redhat/redhat_osv/osv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ScoreTest(unittest.TestCase):
def test_missing_cvss_v3(self):
"""Test parsing a CSAF file with missing CVSSv3 score"""
for test_csaf_file in self.test_csaf_files:
csaf_file = f"testdata/{test_csaf_file}"
csaf_file = f"testdata/CSAF/{test_csaf_file}"
with open(csaf_file, "r", encoding="utf-8") as fp:
csaf_data = fp.read()
csaf = CSAF(csaf_data)
Expand All @@ -27,6 +27,7 @@ def test_missing_cvss_v3(self):
for remediation in vuln.remediations:
assert "@" in remediation.purl

# See https://github.com/ossf/osv-schema/pull/308#issuecomment-2456061864
osv = OSV(csaf, "test_date")
assert not hasattr(osv, "severity")
for affected in osv.affected:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4220311

Please sign in to comment.