diff options
| author | Roberto Bertó <463349+robertoberto@users.noreply.github.com> | 2026-05-19 03:15:55 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-19 03:15:55 -0300 |
| commit | 294d060ac1557ed70cab7a12f97d930f9dc4baf9 (patch) | |
| tree | 25e03a160fb1dc05a27a9118a7a6f573f0ffd123 /tests/test_exceptions.py | |
| parent | ffd5ba16eb1ada42a582db4ac8bdaf29f66a868f (diff) | |
| parent | 6071528289e4a8b11a772433c33851136d30f133 (diff) | |
| download | pyvyos-294d060ac1557ed70cab7a12f97d930f9dc4baf9.tar.gz pyvyos-294d060ac1557ed70cab7a12f97d930f9dc4baf9.zip | |
Merge pull request #31 from vyos-contrib/release/v0.4.0-cleanupv0.4.0
Release v0.4.0 — cleanup and consolidation
Diffstat (limited to 'tests/test_exceptions.py')
| -rw-r--r-- | tests/test_exceptions.py | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py deleted file mode 100644 index 22a4f34..0000000 --- a/tests/test_exceptions.py +++ /dev/null @@ -1,51 +0,0 @@ -"""Tests for pyvyos.exceptions module.""" - -import pytest - -from pyvyos.exceptions import SDKError, HttpError, ApiError, ValidationError - - -def test_sdk_error_base(): - """Test SDKError is base exception.""" - assert issubclass(HttpError, SDKError) - assert issubclass(ApiError, SDKError) - assert issubclass(ValidationError, SDKError) - - -def test_http_error(): - """Test HttpError creation and attributes.""" - error = HttpError(status=404, message="Not Found") - assert error.status == 404 - assert error.message == "Not Found" - assert "404" in str(error) - assert "Not Found" in str(error) - - -def test_api_error(): - """Test ApiError creation.""" - error = ApiError(message="API failure") - assert error.message == "API failure" - assert "API failure" in str(error) - - -def test_api_error_with_details(): - """Test ApiError with details.""" - details = {"code": "ERR001", "field": "path"} - error = ApiError(message="Validation failed", details=details) - assert error.message == "Validation failed" - assert error.details == details - - -def test_validation_error(): - """Test ValidationError creation.""" - error = ValidationError(message="Invalid path format") - assert error.message == "Invalid path format" - assert "Invalid path format" in str(error) - - -def test_exceptions_raiseable(): - """Test that exceptions can be raised and caught.""" - with pytest.raises(HttpError) as exc_info: - raise HttpError(status=500, message="Internal Error") - assert exc_info.value.status == 500 - |
