Skip to content

Commit f2ee11e

Browse files
committed
Fixing ruff
1 parent 3ec6b4c commit f2ee11e

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

unittests/tools/test_generic_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def test_parse_endpoints_and_vulnerability_ids_json(self):
572572
self.assertEqual("CVE-2015-9235", finding.unsaved_vulnerability_ids[1])
573573

574574
def test_mitigated_csv_findings(self):
575-
with open(get_unit_tests_scans_path("generic") / "generic_report3.csv", encoding="utf-8") as file:
575+
with (get_unit_tests_scans_path("generic") / "generic_report3.csv").open(encoding="utf-8") as file:
576576
parser = GenericParser()
577577
findings = parser.get_findings(file, Test())
578578
self.assertEqual(2, len(findings))

unittests/tools/test_h1_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_parse_file_with_multiple_vuln_has_multiple_finding_including_closed_fin
3737
with patch("django.utils.timezone.now") as mock_now:
3838
mock_now.return_value = datetime(2024, 10, 1, 12, 0, 0)
3939

40-
with open(get_unit_tests_scans_path("h1") / "vuln_disclosure_main_state.json", encoding="utf-8") as testfile:
40+
with (get_unit_tests_scans_path("h1") / "vuln_disclosure_main_state.json").open(encoding="utf-8") as testfile:
4141
parser = H1Parser()
4242
findings = parser.get_findings(testfile, Test())
4343
self.assertEqual(4, len(findings))

unittests/tools/test_immuniweb_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_parse_file_with_multiple_vuln_has_multiple_findings(self):
3030
self.assertGreater(len(findings), 2)
3131

3232
def test_parse_file_with_multiple_vuln_has_multiple_findings_json(self):
33-
with open(get_unit_tests_scans_path("immuniweb") / "ImmuniWeb-multiple-vuln.json", encoding="utf-8") as testfile:
33+
with (get_unit_tests_scans_path("immuniweb") / "ImmuniWeb-multiple-vuln.json").open(encoding="utf-8") as testfile:
3434
parser = ImmuniwebParser()
3535
findings = parser.get_findings(testfile, Test())
3636
self.assertEqual(5, len(findings))

unittests/tools/test_sysdig_cli_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class TestSysdigParsers(DojoTestCase):
77

88
def test_sysdig_parser_with_many_vuln_has_many_findings_cli(self):
9-
with open(get_unit_tests_scans_path("sysdig_cli") / "sysdig_reports_many_vul.csv", encoding="utf-8") as testfile:
9+
with (get_unit_tests_scans_path("sysdig_cli") / "sysdig_reports_many_vul.csv").open(encoding="utf-8") as testfile:
1010
parser = SysdigCLIParser()
1111
findings = parser.get_findings(testfile, Test())
1212
for finding in findings:
@@ -24,7 +24,7 @@ def test_sysdig_parser_with_many_vuln_has_many_findings_cli(self):
2424
self.assertEqual("0.00587", finding.epss_score)
2525

2626
def test_sysdig_parser_json_with_many_findings_cli(self):
27-
with open(get_unit_tests_scans_path("sysdig_cli") / "sysdig_reports_many_vul.json", encoding="utf-8") as testfile:
27+
with (get_unit_tests_scans_path("sysdig_cli") / "sysdig_reports_many_vul.json").open(encoding="utf-8") as testfile:
2828
parser = SysdigCLIParser()
2929
findings = parser.get_findings(testfile, Test())
3030
for finding in findings:

unittests/tools/test_wiz_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_sca_format(self):
123123
self.assertNotIn("**Location Path**:", finding.mitigation)
124124

125125
def test_resolved_findings(self):
126-
with open(get_unit_tests_scans_path("wiz") / "resolved_findings.csv", encoding="utf-8") as testfile:
126+
with (get_unit_tests_scans_path("wiz") / "resolved_findings.csv").open(encoding="utf-8") as testfile:
127127
parser = WizParser()
128128
findings = parser.get_findings(testfile, Test())
129129
for finding in findings:

0 commit comments

Comments
 (0)