fix: normalize nullable repository descriptions (#54)
This commit is contained in:
1 parent
60b6f1a74d
commit
6a22bc212d
2 files changed
+30
-2
No files matched your search
@@ -62,4 +62,32 @@ async def test_context_normalizes_nullable_issue_collections(monkeypatch):
|
||||
issue = json.loads(response.body)["issues"][0]
|
||||
|
||||
assert issue["labels"] == []
|
||||
assert issue["assignees"] == []
|
||||
assert issue["assignees"] == []
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_context_normalizes_nullable_repository_description(monkeypatch):
|
||||
async def user():
|
||||
return {"id": 1, "login": "timmy"}
|
||||
|
||||
async def empty_collection():
|
||||
return []
|
||||
|
||||
async def repo_collection():
|
||||
return [{
|
||||
"id": 54,
|
||||
"name": "dashboard",
|
||||
"full_name": "stackchain/dashboard",
|
||||
"description": None,
|
||||
"html_url": "https://forge.example/stackchain/dashboard",
|
||||
}]
|
||||
|
||||
monkeypatch.setattr(main, "current_user", user)
|
||||
monkeypatch.setattr(main, "repos", repo_collection)
|
||||
monkeypatch.setattr(main, "issues", empty_collection)
|
||||
monkeypatch.setattr(main, "pull_requests", empty_collection)
|
||||
|
||||
response = await main.context()
|
||||
repository = json.loads(response.body)["repos"][0]
|
||||
|
||||
assert repository["description"] == ""
|
||||
Reference in new issue
Block a user