feat(cli,display): add --health check and repo description column
Add --health option to verify Gitea connectivity and display version. Add Description column (truncated at 40 chars) with --no-desc to hide it. Add get_version() method to GiteaClient. fixes #14 fixes #15 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -287,6 +287,30 @@ class TestGetWithRetry429:
|
||||
assert mock_sleep.call_count == 2
|
||||
|
||||
|
||||
class TestGetVersion:
|
||||
"""Test get_version method."""
|
||||
|
||||
def test_get_version_success(self):
|
||||
"""Returns version dict on success."""
|
||||
client = GiteaClient("http://gitea.local:3000", "tok")
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.status_code = 200
|
||||
mock_resp.json.return_value = {"version": "1.21.0"}
|
||||
|
||||
with patch.object(client.session, "get", return_value=mock_resp):
|
||||
result = client.get_version()
|
||||
|
||||
assert result == {"version": "1.21.0"}
|
||||
|
||||
def test_get_version_connection_error(self):
|
||||
"""ConnectionError propagates to caller."""
|
||||
client = GiteaClient("http://gitea.local:3000", "tok")
|
||||
|
||||
with patch.object(client.session, "get", side_effect=requests.ConnectionError("refused")):
|
||||
with pytest.raises(requests.ConnectionError):
|
||||
client.get_version()
|
||||
|
||||
|
||||
class TestGetPaginatedEdgeCases:
|
||||
"""Test edge cases for API responses."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user