Skip to content

Commit ab5c48f

Browse files
authored
Merge pull request #18 from zkarpinski/deepsource-autofix-84da5e66
refactor: remove unused imports
2 parents 0276f1c + 265110c commit ab5c48f

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

codeinsight_sdk/handler.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import abc
22
from typing import List
33

4-
from .models import Project, ProjectInventory, ProjectInventoryItem, Report
5-
from .exceptions import CodeInsightError
64

75
class Handler(abc.ABC):
86
def __init__(self, client):
@@ -12,4 +10,3 @@ def __init__(self, client):
1210
@abc.abstractmethod
1311
def get(self):
1412
pass
15-

tests/test_experimental.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66

77
from codeinsight_sdk import CodeInsightClient
8-
from codeinsight_sdk.exceptions import CodeInsightError
98

109
logger = logging.getLogger(__name__)
1110

1211
## CHANGE ME ##
1312
TEST_URL = "https://api.revenera.com"
1413
TEST_API_TOKEN = "your_api_token"
1514

15+
1616
class TestExperimental:
1717
@pytest.fixture
1818
def client(self):
1919
return CodeInsightClient(TEST_URL, TEST_API_TOKEN, experimental=True)
20-
20+
2121
def test_experimental_enabled(self, client):
2222
assert client.experimental_enabled == True
23-
23+
2424
def test_get_project_vulnerabilities(self, client):
2525
project_id = 1
2626
total_pages = 4
@@ -86,11 +86,21 @@ def test_get_project_vulnerabilities(self, client):
8686
"vulnerabilityCvssV3Severity":"CRITICAL"} ] }
8787
"""
8888
with requests_mock.Mocker() as m:
89-
m.get(f"{TEST_URL}/codeinsight/api/projects/{project_id}/inventorySummary",
90-
text=fake_response_json, headers=response_header)
91-
m.get(f"{TEST_URL}/codeinsight/api/inventories/12346/vulnerabilities",
92-
text=mock_resp_vuln, headers=response_header)
93-
vulnerable_items = client.experimental.get_project_vulnerabilities(project_id)
89+
m.get(
90+
f"{TEST_URL}/codeinsight/api/projects/{project_id}/inventorySummary",
91+
text=fake_response_json,
92+
headers=response_header,
93+
)
94+
m.get(
95+
f"{TEST_URL}/codeinsight/api/inventories/12346/vulnerabilities",
96+
text=mock_resp_vuln,
97+
headers=response_header,
98+
)
99+
vulnerable_items = client.experimental.get_project_vulnerabilities(
100+
project_id
101+
)
94102
assert len(vulnerable_items) > 0
95103
assert vulnerable_items[0].vulnerabilities is not None
96-
assert vulnerable_items[0].vulnerabilities[1].vulnerabilityName == "CVE-987-65432"
104+
assert (
105+
vulnerable_items[0].vulnerabilities[1].vulnerabilityName == "CVE-987-65432"
106+
)

tests/test_handlers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import pytest
22

33
from codeinsight_sdk import CodeInsightClient
4-
from codeinsight_sdk.handlers import ProjectHandler, ReportHandler
5-
from codeinsight_sdk.models import Project, Report
64

75

86
class TestHandlers(object):
97
@pytest.fixture
108
def client(self):
11-
return CodeInsightClient("","")
9+
return CodeInsightClient("", "")

0 commit comments

Comments
 (0)