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:
sylvain
2026-03-12 19:18:03 +01:00
parent 2ef7ec175e
commit 1b33cd36f9
6 changed files with 245 additions and 9 deletions

View File

@@ -230,6 +230,66 @@ class TestRenderDashboardEmpty:
assert "Aucun repo" in output
class TestDescriptionColumn:
"""Test Description column in dashboard table."""
def test_description_column_displayed(self):
"""Table contains a Description column by default."""
console, buf = _make_console()
repos = [_make_repo(name="test", description="My project")]
render_dashboard(repos, console=console)
output = buf.getvalue()
assert "Description" in output
assert "My project" in output
def test_description_truncated_at_40(self):
"""Description longer than 40 chars is truncated with '...'."""
console, buf = _make_console()
long_desc = "A" * 60
repos = [_make_repo(name="test", description=long_desc)]
render_dashboard(repos, console=console)
output = buf.getvalue()
# Should contain first 40 chars + "..."
assert "A" * 40 + "..." in output
# Should NOT contain the full 60-char string
assert "A" * 60 not in output
def test_description_short_not_truncated(self):
"""Description of 20 chars is displayed as-is."""
console, buf = _make_console()
repos = [_make_repo(name="test", description="Short description")]
render_dashboard(repos, console=console)
output = buf.getvalue()
assert "Short description" in output
def test_description_empty(self):
"""Empty description renders without crash."""
console, buf = _make_console()
repos = [_make_repo(name="test", description="")]
render_dashboard(repos, console=console)
output = buf.getvalue()
assert "test" in output
def test_no_description_flag(self):
"""show_description=False hides the Description column."""
console, buf = _make_console()
repos = [_make_repo(name="test", description="My project")]
render_dashboard(repos, console=console, show_description=False)
output = buf.getvalue()
assert "Description" not in output
assert "test" in output
class TestRenderDashboardEdgeCases:
"""Test edge cases for dashboard rendering."""