Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
params = FullScanParams(
org_slug="org_name",
repo="TestRepo",
workspace="my-workspace",
branch="main",
commit_message="Test Commit Message",
commit_hash="abc123def456",
Expand Down Expand Up @@ -223,6 +224,8 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
+------------------------+------------+-------------------------------------------------------------------------------+
| tmp | False | Boolean temporary flag |
+------------------------+------------+-------------------------------------------------------------------------------+
| workspace | False | The workspace of the repository to associate the full-scan with. |
+------------------------+------------+-------------------------------------------------------------------------------+
| integration_type | False | IntegrationType enum value (e.g., "api", "github") |
+------------------------+------------+-------------------------------------------------------------------------------+
| integration_org_slug | False | Organization slug for integration |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "socketdev"
version = "3.0.29"
version = "3.0.30"
requires-python = ">= 3.9"
dependencies = [
'requests',
Expand Down
2 changes: 2 additions & 0 deletions socketdev/fullscans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class FullScanParams:
set_as_pending_head: Optional[bool] = None
tmp: Optional[bool] = None
scan_type: Optional[ScanType] = None
workspace: Optional[str] = None

def __getitem__(self, key):
return getattr(self, key)
Expand All @@ -131,6 +132,7 @@ def from_dict(cls, data: dict) -> "FullScanParams":
set_as_pending_head=data.get("set_as_pending_head"),
tmp=data.get("tmp"),
scan_type=ScanType(scan_type) if scan_type is not None else None,
workspace=data.get("workspace"),
)


Expand Down
2 changes: 1 addition & 1 deletion socketdev/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.29"
__version__ = "3.0.30"
32 changes: 32 additions & 0 deletions tests/unit/test_working_endpoints_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,38 @@ def test_fullscans_post_unit(self):
finally:
os.unlink(f.name)

def test_fullscans_post_with_workspace_unit(self):
"""Test that workspace is included in the query string when set on FullScanParams."""
expected_data = {"id": "new-scan"}
self._mock_response(expected_data, 201)

params = FullScanParams(
repo="assembly",
org_slug="test-org",
branch="main",
workspace="grofers",
)

with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f:
json.dump({"name": "test", "version": "1.0.0"}, f)
f.flush()

try:
with open(f.name, "rb") as file_obj:
files = [("file", ("package.json", file_obj))]
result = self.sdk.fullscans.post(files, params)

self.assertEqual(result, expected_data)
call_args = self.mock_requests.request.call_args
self.assertEqual(call_args[0][0], "POST")
# Confirm workspace landed in the request URL query string
request_url = call_args[0][1]
self.assertIn("workspace=grofers", request_url)
self.assertIn("repo=assembly", request_url)

finally:
os.unlink(f.name)

def test_triage_list_alert_triage_unit(self):
"""Test triage list alerts - WORKING."""
expected_data = {"alerts": []}
Expand Down
Loading