Fix Forgejo issue lifecycle identifiers
This commit is contained in:
parent
d58bfd1f96
commit
3523a7decc
3 changed files with 33 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import os
|
|||
import tempfile
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ pytest.importorskip("httpx")
|
|||
from fastapi.testclient import TestClient
|
||||
|
||||
from issue_core.api.app import create_app
|
||||
from issue_core.api.ingest import _public_issue_id
|
||||
|
||||
|
||||
API_KEY = "test-key-not-a-real-secret-only-for-pytest"
|
||||
|
|
@ -75,6 +77,20 @@ def test_healthz(client):
|
|||
assert response.json()["status"] == "ok"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_public_issue_id_uses_repository_number_for_gitea():
|
||||
issue = SimpleNamespace(id="91234", number=176)
|
||||
|
||||
assert _public_issue_id(issue, "gitea") == "176"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_public_issue_id_preserves_native_local_id():
|
||||
issue = SimpleNamespace(id="2c29792e-1234-4567-890a-22c4fa664abc", number=12)
|
||||
|
||||
assert _public_issue_id(issue, "local") == issue.id
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_ingest_rejects_missing_api_key(client, valid_payload):
|
||||
response = client.post("/issues/", json=valid_payload)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue