Skip to content

Commit 8ec189b

Browse files
committed
test: update legacy FOSSA-shape assertions for wrapper parity
Pin project.id to dollar separator, replace 2-key SBOM with 5-key shape, and update per-dependency assertions to the 14-key _build_dependency_entry contract.
1 parent 950c2c4 commit 8ec189b

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

tests/unit/test_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_json_file_saving_in_fossa_format(self, tmp_path):
322322
saved = json.loads(json_path.read_text())
323323
assert saved["project"] == {
324324
"branch": "refs/heads/main",
325-
"id": "owner/repo-scan-123",
325+
"id": "owner/repo$scan-123",
326326
"project": "owner/repo",
327327
"projectId": "owner/repo",
328328
"revision": "scan-123",

tests/unit/test_socketcli.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,11 @@ class Config:
5757
payload = build_license_artifact_payload(diff, legal_format="fossa", config=Config())
5858

5959
assert payload == {
60-
"project": {
61-
"branch": "main",
62-
"id": "owner/repo-scan-1",
63-
"project": "owner/repo",
64-
"projectId": "owner/repo",
65-
"revision": "scan-1",
66-
"url": "https://socket.dev/report/1",
67-
},
68-
"dependencies": [],
60+
"copyrightsByLicense": {},
61+
"deepDependencies": [],
62+
"directDependencies": [],
63+
"licenses": {},
64+
"project": {"name": "owner/repo", "revision": "scan-1"},
6965
}
7066

7167

@@ -115,16 +111,23 @@ class Config:
115111

116112
payload = build_license_artifact_payload(diff, legal_format="fossa", config=Config())
117113

118-
assert payload["project"]["projectId"] == "owner/repo"
119-
assert payload["dependencies"] == [{
120-
"id": "pkg-1",
121-
"name": "requests",
114+
assert payload["project"] == {"name": "owner/repo", "revision": "scan-1"}
115+
assert payload["directDependencies"] == [{
116+
"authors": [],
117+
"dependencyPaths": ["requests"],
118+
"description": "",
119+
"downloadUrl": "",
120+
"hash": None,
121+
"isGolang": None,
122+
"licenses": [{"attribution": "", "name": "Apache-2.0"}],
123+
"notes": [],
124+
"otherLicenses": [],
125+
"package": "requests",
126+
"projectUrl": "",
127+
"source": "pip",
128+
"title": "requests",
122129
"version": "2.31.0",
123-
"ecosystem": "pip",
124-
"direct": True,
125-
"url": "https://socket.dev/pypi/package/requests/overview/2.31.0",
126-
"purl": "pkg:pypi/requests@2.31.0",
127-
"declaredLicense": "Apache-2.0",
128-
"licenseDetails": [{"id": "Apache-2.0"}],
129-
"licenseAttrib": [{"id": "Apache-2.0"}],
130130
}]
131+
assert payload["deepDependencies"] == []
132+
assert payload["copyrightsByLicense"] == {}
133+
assert payload["licenses"] == {}

0 commit comments

Comments
 (0)