diff --git a/pyproject.toml b/pyproject.toml index b97b217..d6e5f17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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', diff --git a/socketdev/fullscans/__init__.py b/socketdev/fullscans/__init__.py index f295237..dd4c6b7 100644 --- a/socketdev/fullscans/__init__.py +++ b/socketdev/fullscans/__init__.py @@ -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): diff --git a/socketdev/version.py b/socketdev/version.py index 911557b..1173108 100644 --- a/socketdev/version.py +++ b/socketdev/version.py @@ -1 +1 @@ -__version__ = "3.1.2" +__version__ = "3.2.0" diff --git a/tests/unit/test_socket_alert_category.py b/tests/unit/test_socket_alert_category.py index 02ce1c1..c55113b 100644 --- a/tests/unit/test_socket_alert_category.py +++ b/tests/unit/test_socket_alert_category.py @@ -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): @@ -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}", diff --git a/uv.lock b/uv.lock index 18c95ab..98f3daf 100644 --- a/uv.lock +++ b/uv.lock @@ -1353,7 +1353,7 @@ wheels = [ [[package]] name = "socketdev" -version = "3.1.2" +version = "3.2.0" source = { editable = "." } dependencies = [ { name = "requests" },