Skip to content

Commit

Permalink
fix security_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis-Mittenzwei committed Oct 18, 2024
1 parent 931d09d commit 2ec6a64
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions test/unit/security_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,28 +411,28 @@ def test_format_jsonl_removes_newline():
[
(
'''{
"results": [
{
"code": "1 import subprocess\n2 from typing import Iterable\n3 \n",
"col_offset": 0,
"end_col_offset": 17,
"filename": "/home/test/Git/python-toolbox/exasol/toolbox/git.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with the subprocess module.",
"line_number": 1,
"line_range": [
1
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b404-import-subprocess",
"test_id": "B404",
"test_name": "blacklist"
}
]
"results": [
{
"code": "1 import subprocess\\n2 from typing import Iterable\\n3 \\n",
"col_offset": 0,
"end_col_offset": 17,
"filename": "/home/test/Git/python-toolbox/exasol/toolbox/git.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 78,
"link": "https://cwe.mitre.org/data/definitions/78.html"
},
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with the subprocess module.",
"line_number": 1,
"line_range": [
1
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/blacklists/blacklist_imports.html#b404-import-subprocess",
"test_id": "B404",
"test_name": "blacklist"
}
]
}
''',
{
Expand All @@ -449,15 +449,12 @@ def test_format_jsonl_removes_newline():
]
)
def test_from_json(json_file, expected):
issues = security.from_json(json_file, pathlib.Path("/home/test/Git/python-toolbox"))
actual = security.from_json(json_file, pathlib.Path("/home/test/Git/python-toolbox"))
expected_issue = security.Issue(
cve=expected["cve"],
cwe=expected["cwe"],
description=expected["description"],
coordinates=expected["coordinates"],
references=expected["references"]
)
actual = []
for issue in issues:
actual.append(issue)
assert actual == [expected_issue]
assert list(actual) == [expected_issue]

0 comments on commit 2ec6a64

Please sign in to comment.