fix: detect Gitea issues with null pull request metadata
This commit is contained in:
@@ -89,6 +89,36 @@ def test_sync_and_scan_with_mocked_gitea(db, tmp_path):
|
||||
assert len(task_ids) == 1
|
||||
|
||||
|
||||
def test_list_open_issues_keeps_normal_issues_with_null_pull_request():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.url.path == "/api/v1/repos/acme/service/issues"
|
||||
return httpx.Response(
|
||||
200,
|
||||
json=[
|
||||
{
|
||||
"number": 1,
|
||||
"title": "Normal issue",
|
||||
"body": "Body",
|
||||
"state": "open",
|
||||
"labels": [{"name": "agent:ready"}],
|
||||
"pull_request": None,
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"title": "PR issue",
|
||||
"body": "Body",
|
||||
"state": "open",
|
||||
"labels": [{"name": "agent:ready"}],
|
||||
"pull_request": {"url": "https://gitea.test/pr/2"},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
issues = make_client(handler).list_open_issues("acme", "service")
|
||||
|
||||
assert [issue.number for issue in issues] == [1]
|
||||
|
||||
|
||||
class FakeWorkspaceManager:
|
||||
def __init__(self, root: Path, *, diff: bool = True):
|
||||
self.root = root
|
||||
|
||||
Reference in New Issue
Block a user