Skip to content

Commit a5da289

Browse files
committed
fix vulnerabilities typo in model.
Added test
1 parent d66adb9 commit a5da289

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

codeinsight_sdk/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ProjectInventoryItem(DataClassJsonMixin):
3838
url: Optional[str] = None
3939
componentUrl: Optional[str] = None
4040
componentDescription: Optional[str] = None
41-
vulnerabilites: Optional[List[Vulnerability]] = None
41+
vulnerabilities: Optional[List[Vulnerability]] = None
4242
vulnerabilitySummary: Optional[Dict[str, Dict]] = None
4343
filePaths: Optional[List[str]] = None
4444

tests/test_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_get_project_inventory_multipage(self,client):
113113

114114
fake_response_json = """
115115
{ "projectId": 1, "inventoryItems": [
116-
{"itemNumber":1, "id":1234, "name":"Example component","type":"component","priority":"low","createdBy":"Zach","createdOn":"Today","updatedOn":"Tomorrow","componentName":"snakeyaml","componentVersionName":"2.0"},
116+
{"itemNumber":1, "id":1234, "name":"Example component","type":"component","priority":"low","createdBy":"Zach","createdOn":"Today","updatedOn":"Tomorrow","componentName":"snakeyaml","componentVersionName":"2.0","vulnerabilities":[{"vulnerabilityId":1,"vulnerabilityName":"CVE-2020-1234","vulnerabilityDescription":"Example vulnerability","vulnerabilityCvssV3Score":9.8,"vulnerabilityCvssV3Severity":"Critical"}]},
117117
{"itemNumber":2, "id":1235, "name":"Example component 2","type":"component","priority":"low","createdBy":"Zach","createdOn":"Today","updatedOn":"Tomorrow","componentName":"snakeyaml","componentVersionName":"2.0"}
118118
]}
119119
"""
@@ -123,6 +123,7 @@ def test_get_project_inventory_multipage(self,client):
123123
project_inventory = client.projects.get_inventory(project_id)
124124
assert project_inventory.projectId == project_id
125125
assert len(project_inventory.inventoryItems) == total_records
126+
assert project_inventory.inventoryItems[0].vulnerabilities[0].vulnerabilityName == "CVE-2020-1234"
126127

127128
#### FIX THIS! ####
128129
def test_get_project_inventory_summary(self,client):

0 commit comments

Comments
 (0)