GRM-20: refactor(scripts): centralize constants, API clients, and HTTP status codes

- Add shared config.py with API URLs, regexes, timeouts, pagination
- Add GiteaClient and VikunjaClient in api_clients.py with pooled sessions
- Add APIError exception for unified HTTP error handling
- Refactor all scripts to use shared modules and http.HTTPStatus
- Rewrite unit tests to mock clients and use HTTPStatus constants
- Add tests for api_clients and config modules
- Achieve 100% test coverage
This commit is contained in:
Emil Simeonov
2026-06-19 21:00:21 +02:00
parent 790b5c3769
commit fefddda715
15 changed files with 751 additions and 682 deletions
+9
View File
@@ -11,3 +11,12 @@ class AnsibleError(GRMError):
"""Raised when an Ansible command fails."""
pass
class APIError(GRMError):
"""Raised when a REST API call returns an HTTP error."""
def __init__(self, status: int, message: str) -> None:
self.status = status
self.message = message
super().__init__(f"HTTP {status}: {message}")