diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-30 10:40:20 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-30 10:40:20 +0200 |
| commit | b357d987b3a149924dbc4eb584ab36529aaf195d (patch) | |
| tree | 9c7e045180f5bd057ed6c1a1f0c2715be07bf89e /tests | |
| parent | a305c9a0c024e912548631e464e5f08ac24b1562 (diff) | |
| download | firefly-cli-b357d987b3a149924dbc4eb584ab36529aaf195d.tar.gz firefly-cli-b357d987b3a149924dbc4eb584ab36529aaf195d.zip | |
feat: error types
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/__init__.py | 0 | ||||
| -rw-r--r-- | tests/unit/__init__.py | 0 | ||||
| -rw-r--r-- | tests/unit/test_errors.py | 16 |
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/unit/__init__.py diff --git a/tests/unit/test_errors.py b/tests/unit/test_errors.py new file mode 100644 index 0000000..63731c5 --- /dev/null +++ b/tests/unit/test_errors.py @@ -0,0 +1,16 @@ +import unittest +from firefly_cli.errors import FireflyError, ConfigError, ApiError, ResolutionError + +class TestErrors(unittest.TestCase): + def test_subclassing(self): + for cls in (ConfigError, ApiError, ResolutionError): + self.assertTrue(issubclass(cls, FireflyError)) + + def test_api_error_carries_status_and_body(self): + e = ApiError(422, {"message": "bad"}) + self.assertEqual(e.status, 422) + self.assertEqual(e.body, {"message": "bad"}) + self.assertIn("422", str(e)) + +if __name__ == "__main__": + unittest.main() |
