Skip to content

Commit 5fd7f6d

Browse files
fix tests
1 parent 56eb50c commit 5fd7f6d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

dojo/validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def cvss3_validator(value: str | list[str], exception_class: Callable = Validati
3737
return
3838

3939
if isinstance(vector_obj, CVSS4):
40-
msg = "CVSS4 vector vannot be stored in the cvss3 field. Use the cvss4 field."
40+
msg = "CVSS4 vector cannot be stored in the cvssv3 field. Use the cvssv4 field."
4141
raise exception_class(msg)
4242
if isinstance(vector_obj, CVSS2):
4343
msg = "Unsupported CVSS2 version detected."
@@ -64,7 +64,7 @@ def cvss4_validator(value: str | list[str], exception_class: Callable = Validati
6464
return
6565

6666
if isinstance(vector_obj, CVSS3):
67-
msg = "CVSS3 vector vannot be stored in the cvss3 field. Use the cvss3 field."
67+
msg = "CVSS3 vector cannot be stored in the cvssv4 field. Use the cvssv3 field."
6868
raise exception_class(msg)
6969
if isinstance(vector_obj, CVSS2):
7070
msg = "Unsupported CVSS2 version detected."

tests/finding_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_edit_finding_cvssv3_with_v4_vector(self):
258258
expected_cvssv3_value="CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
259259
expected_cvssv3_score="5",
260260
expect_success=False,
261-
error_message="CVSS4 vector vannot be stored in the cvss3 field. Use the cvss4 field.",
261+
error_message="CVSS4 vector cannot be stored in the cvssv3 field. Use the cvssv4 field.",
262262
)
263263

264264
@on_exception_html_source_logger
@@ -345,7 +345,7 @@ def test_edit_finding_cvssv4_with_v3_vector(self):
345345
expected_cvssv4_value="CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
346346
expected_cvssv4_score="5",
347347
expect_success=False,
348-
error_message="CVSS3 vector vannot be stored in the cvss4 field. Use the cvss3 field.",
348+
error_message="CVSS3 vector cannot be stored in the cvssv4 field. Use the cvssv3 field.",
349349
)
350350

351351
@on_exception_html_source_logger

unittests/test_rest_framework.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,10 +1378,10 @@ def test_cvss3_validation(self):
13781378
self.assertEqual(None, finding.cvssv3_score)
13791379

13801380
with self.subTest(i=8):
1381-
# CVSS4 prefix makes it invalid
1381+
# CVSS4
13821382
result = self.client.patch(self.url + "3/", data={"cvssv3": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N", "cvssv3_score": 7})
13831383
self.assertEqual(result.status_code, status.HTTP_400_BAD_REQUEST)
1384-
self.assertEqual(result.json()["cvssv3"], ["CVSS(4) vector vannot be stored in the cvss3 field. Use the cvss4 fields."])
1384+
self.assertEqual(result.json()["cvssv3"], ["CVSS3 vector cannot be stored in the cvssv4 field. Use the cvssv3 field."])
13851385
finding = Finding.objects.get(id=3)
13861386
# invalid vector, so no calculated score and no score stored
13871387
self.assertEqual(None, finding.cvssv3)

0 commit comments

Comments
 (0)