test: add edge case tests for unicode, empty repos, malformed API
Add tests for unicode descriptions, repos with no commits and no release, malformed JSON responses, HTML responses, control characters in names, empty and very long descriptions. fixes #13 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,26 @@ class TestSanitizeControlChars:
|
||||
assert result[0]["full_name"] == "admin/testrepo"
|
||||
|
||||
|
||||
class TestExportJsonEdgeCases:
|
||||
"""Test edge cases for JSON export."""
|
||||
|
||||
def test_export_json_empty_description(self):
|
||||
"""Empty description produces valid JSON."""
|
||||
repo = _make_repo(description="")
|
||||
output = export_json([repo])
|
||||
|
||||
parsed = json.loads(output)
|
||||
assert parsed[0]["description"] == ""
|
||||
|
||||
def test_export_json_very_long_description(self):
|
||||
"""Very long description (10000 chars) produces valid JSON."""
|
||||
repo = _make_repo(description="x" * 10000)
|
||||
output = export_json([repo])
|
||||
|
||||
parsed = json.loads(output)
|
||||
assert len(parsed[0]["description"]) == 10000
|
||||
|
||||
|
||||
class TestExportJson:
|
||||
"""Test export_json function."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user