Skip to content

Commit 2ec6a64

Browse files
fix security_test.py
1 parent 931d09d commit 2ec6a64

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

test/unit/security_test.py

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -411,28 +411,28 @@ def test_format_jsonl_removes_newline():
411411
[
412412
(
413413
'''{
414-
"results": [
415-
{
416-
"code": "1 import subprocess\n2 from typing import Iterable\n3 \n",
417-
"col_offset": 0,
418-
"end_col_offset": 17,
419-
"filename": "/home/test/Git/python-toolbox/exasol/toolbox/git.py",
420-
"issue_confidence": "HIGH",
421-
"issue_cwe": {
422-
"id": 78,
423-
"link": "https://cwe.mitre.org/data/definitions/78.html"
424-
},
425-
"issue_severity": "LOW",
426-
"issue_text": "Consider possible security implications associated with the subprocess module.",
427-
"line_number": 1,
428-
"line_range": [
429-
1
430-
],
431-
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b404-import-subprocess",
432-
"test_id": "B404",
433-
"test_name": "blacklist"
434-
}
435-
]
414+
"results": [
415+
{
416+
"code": "1 import subprocess\\n2 from typing import Iterable\\n3 \\n",
417+
"col_offset": 0,
418+
"end_col_offset": 17,
419+
"filename": "/home/test/Git/python-toolbox/exasol/toolbox/git.py",
420+
"issue_confidence": "HIGH",
421+
"issue_cwe": {
422+
"id": 78,
423+
"link": "https://cwe.mitre.org/data/definitions/78.html"
424+
},
425+
"issue_severity": "LOW",
426+
"issue_text": "Consider possible security implications associated with the subprocess module.",
427+
"line_number": 1,
428+
"line_range": [
429+
1
430+
],
431+
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b404-import-subprocess",
432+
"test_id": "B404",
433+
"test_name": "blacklist"
434+
}
435+
]
436436
}
437437
''',
438438
{
@@ -449,15 +449,12 @@ def test_format_jsonl_removes_newline():
449449
]
450450
)
451451
def test_from_json(json_file, expected):
452-
issues = security.from_json(json_file, pathlib.Path("/home/test/Git/python-toolbox"))
452+
actual = security.from_json(json_file, pathlib.Path("/home/test/Git/python-toolbox"))
453453
expected_issue = security.Issue(
454454
cve=expected["cve"],
455455
cwe=expected["cwe"],
456456
description=expected["description"],
457457
coordinates=expected["coordinates"],
458458
references=expected["references"]
459459
)
460-
actual = []
461-
for issue in issues:
462-
actual.append(issue)
463-
assert actual == [expected_issue]
460+
assert list(actual) == [expected_issue]

0 commit comments

Comments
 (0)