Skip to content

Commit f873cb3

Browse files
committed
feat(tool): fix failing tests
1 parent f5619a0 commit f873cb3

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

test/test_vex_validate.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ def create_temp_vex_file(self, content: dict, filename: str = "test.json") -> st
8787
json.dump(content, f, indent=2)
8888
return str(file_path)
8989

90-
@patch("cve_bin_tool.vex_manager.validate.VEXValidator._get_schema")
91-
def test_valid_cyclonedx_vex(self, mock_get_schema):
90+
@patch("lib4sbom.validator.SBOMValidator.validate_file")
91+
def test_valid_cyclonedx_vex(self, mock_validate_file):
9292
"""Test validation of a valid CycloneDX VEX file."""
93-
mock_get_schema.return_value = self.mock_cyclonedx_schema
93+
# Mock lib4sbom validation to return success
94+
mock_validate_file.return_value = {"CycloneDX": True}
9495

9596
valid_cyclonedx = {
9697
"bomFormat": "CycloneDX",
@@ -234,10 +235,11 @@ def test_unknown_format(self):
234235
self.assertGreaterEqual(len(errors), 1)
235236
self.assertIn("Could not detect VEX format", errors[0].message)
236237

237-
@patch("cve_bin_tool.vex_manager.validate.VEXValidator._get_schema")
238-
def test_empty_vulnerabilities_warning(self, mock_get_schema):
238+
@patch("lib4sbom.validator.SBOMValidator.validate_file")
239+
def test_empty_vulnerabilities_warning(self, mock_validate_file):
239240
"""Test that empty vulnerabilities section generates warning."""
240-
mock_get_schema.return_value = self.mock_cyclonedx_schema
241+
# Mock lib4sbom validation to return success
242+
mock_validate_file.return_value = {"CycloneDX": True}
241243

242244
cyclonedx_no_vulns = {
243245
"bomFormat": "CycloneDX",
@@ -417,10 +419,11 @@ def test_version_detection_edge_cases(self):
417419
# Should fail because bomFormat is case sensitive
418420
self.assertFalse(is_valid)
419421

420-
@patch("cve_bin_tool.vex_manager.validate.VEXValidator._get_schema")
421-
def test_cyclonedx_version_16(self, mock_get_schema):
422+
@patch("lib4sbom.validator.SBOMValidator.validate_file")
423+
def test_cyclonedx_version_16(self, mock_validate_file):
422424
"""Test validation of CycloneDX 1.6 VEX file."""
423-
mock_get_schema.return_value = self.mock_cyclonedx_16_schema
425+
# Mock lib4sbom validation to return success
426+
mock_validate_file.return_value = {"CycloneDX": True}
424427

425428
cyclonedx_16 = {
426429
"bomFormat": "CycloneDX",
@@ -448,10 +451,11 @@ def test_cyclonedx_version_16(self, mock_get_schema):
448451
self.assertTrue(is_valid, f"Validation errors: {errors}")
449452
self.assertEqual(len(errors), 0)
450453

451-
@patch("cve_bin_tool.vex_manager.validate.VEXValidator._get_schema")
452-
def test_cyclonedx_version_15(self, mock_get_schema):
454+
@patch("lib4sbom.validator.SBOMValidator.validate_file")
455+
def test_cyclonedx_version_15(self, mock_validate_file):
453456
"""Test validation of CycloneDX 1.5 VEX file."""
454-
mock_get_schema.return_value = self.mock_cyclonedx_schema
457+
# Mock lib4sbom validation to return success
458+
mock_validate_file.return_value = {"CycloneDX": True}
455459

456460
cyclonedx_15 = {
457461
"bomFormat": "CycloneDX",

0 commit comments

Comments
 (0)