Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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.1.2"
version = "3.2.0"
requires-python = ">= 3.9"
dependencies = [
'requests',
Expand Down
1 change: 1 addition & 0 deletions socketdev/fullscans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SocketCategory(str, Enum):
VULNERABILITY = "vulnerability"
LICENSE = "license"
MISCELLANEOUS = "miscellaneous"
OTHER = "other" # Added to match backend API responses


class DiffType(str, Enum):
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.1.2"
__version__ = "3.2.0"
10 changes: 8 additions & 2 deletions tests/unit/test_socket_alert_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ def test_known_category_is_preserved(self):
self.assertEqual(alert.category, SocketCategory.SUPPLY_CHAIN_RISK)
self.assertEqual(alert.severity, SocketIssueSeverity.LOW)

def test_unknown_category_falls_back_to_miscellaneous(self):
def test_other_category_is_recognized(self):
# "other" is a known backend category as of CE-225; it should resolve to
# SocketCategory.OTHER rather than falling back to MISCELLANEOUS.
alert = SocketAlert.from_dict(self._base_payload("other"))
self.assertEqual(alert.category, SocketCategory.OTHER)

def test_unknown_category_falls_back_to_miscellaneous(self):
alert = SocketAlert.from_dict(self._base_payload("somethingCompletelyNew"))
self.assertEqual(alert.category, SocketCategory.MISCELLANEOUS)

def test_unknown_category_does_not_raise(self):
Expand All @@ -46,7 +52,7 @@ def test_unknown_category_does_not_raise(self):

def test_unknown_category_emits_warning(self):
with self.assertLogs("socketdev", level=logging.WARNING) as captured:
SocketAlert.from_dict(self._base_payload("other"))
SocketAlert.from_dict(self._base_payload("somethingCompletelyNew"))
self.assertTrue(
any("Unknown SocketCategory" in message for message in captured.output),
f"expected a warning about the unknown category, got: {captured.output}",
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading