docs(ISSUE-WP-0006): Forgejo-only language and projection boundary
Prefer Forgejo as the self-hosted forge product. Keep Gitea only as the Gitea-compatible API identifier (module backends/gitea, type string gitea). FORGEJO_TOKEN is preferred; GITEA_* remains a deprecated alias. INTENT/SCOPE quote ACT-ADR-005: issue-core is not the fleet ops claim queue. Connector docs describe repo work record → hub index → optional Forgejo projection, not activity-core → issue-core → harness. Assistant: grok Assistant-Session: 01a09dc6-3f0d-7c93-8b11-8e83c0623d49
This commit is contained in:
parent
f9d276dadf
commit
ee9b85215d
34 changed files with 410 additions and 263 deletions
|
|
@ -53,7 +53,7 @@ class TestCLICommands:
|
|||
], input='https://git.example.com\ntestorg\ntestrepo\n')
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert 'Using API token from GITEA_API_TOKEN environment variable' in result.output
|
||||
assert 'Using API token from FORGEJO_TOKEN environment variable' in result.output
|
||||
assert 'Backend \'test-gitea\' added successfully' in result.output
|
||||
|
||||
# Verify save_backend_configs was called with correct data
|
||||
|
|
@ -205,8 +205,13 @@ class TestEnvironmentTokenDetection:
|
|||
|
||||
@patch('os.getenv')
|
||||
def test_gitea_token_detection(self, mock_getenv):
|
||||
"""Test GITEA_API_TOKEN environment variable detection."""
|
||||
mock_getenv.return_value = 'test-env-token'
|
||||
"""Deprecated GITEA_API_TOKEN alias is still accepted."""
|
||||
def _getenv(name, default=None):
|
||||
if name == 'GITEA_API_TOKEN':
|
||||
return 'test-env-token'
|
||||
return default
|
||||
|
||||
mock_getenv.side_effect = _getenv
|
||||
|
||||
from issue_core.cli.backend_commands import add_backend
|
||||
|
||||
|
|
@ -220,4 +225,5 @@ class TestEnvironmentTokenDetection:
|
|||
], input='https://git.example.com\ntestorg\ntestrepo\n')
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert 'Using API token from GITEA_API_TOKEN environment variable' in result.output
|
||||
assert 'Using API token from GITEA_API_TOKEN' in result.output
|
||||
assert 'deprecated alias; prefer FORGEJO_TOKEN' in result.output
|
||||
|
|
@ -77,7 +77,7 @@ class TestGiteaBackend:
|
|||
backend = GiteaBackend()
|
||||
backend.session = mock_session
|
||||
|
||||
with pytest.raises(GiteaAPIError, match="Failed to connect to Gitea API"):
|
||||
with pytest.raises(GiteaAPIError, match="Failed to connect to Forgejo"):
|
||||
backend.connect(self.test_config)
|
||||
|
||||
def test_url_construction_fix(self):
|
||||
|
|
@ -98,29 +98,29 @@ class TestGiteaBackend:
|
|||
called_url = mock_request.call_args[1]['url'] if 'url' in mock_request.call_args[1] else mock_request.call_args[0][1]
|
||||
assert called_url == 'https://git.example.com/api/v1/repos/owner/repo'
|
||||
|
||||
def test_gitea_payload_omits_name_only_labels(self):
|
||||
"""Gitea issue payloads only include numeric label IDs."""
|
||||
now = datetime.now(timezone.utc)
|
||||
issue = Issue(
|
||||
id="",
|
||||
number=0,
|
||||
title="Test issue",
|
||||
description="Test description",
|
||||
state=IssueState.OPEN,
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
labels=[
|
||||
Label(name="priority:low"),
|
||||
Label(name="source:rule", backend_id="not-a-number"),
|
||||
Label(name="existing", backend_id="42"),
|
||||
],
|
||||
)
|
||||
|
||||
payload = self.backend._unified_issue_to_gitea(issue)
|
||||
|
||||
assert payload["labels"] == [42]
|
||||
assert payload["title"] == "Test issue"
|
||||
|
||||
def test_gitea_payload_omits_name_only_labels(self):
|
||||
"""Gitea issue payloads only include numeric label IDs."""
|
||||
now = datetime.now(timezone.utc)
|
||||
issue = Issue(
|
||||
id="",
|
||||
number=0,
|
||||
title="Test issue",
|
||||
description="Test description",
|
||||
state=IssueState.OPEN,
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
labels=[
|
||||
Label(name="priority:low"),
|
||||
Label(name="source:rule", backend_id="not-a-number"),
|
||||
Label(name="existing", backend_id="42"),
|
||||
],
|
||||
)
|
||||
|
||||
payload = self.backend._unified_issue_to_gitea(issue)
|
||||
|
||||
assert payload["labels"] == [42]
|
||||
assert payload["title"] == "Test issue"
|
||||
|
||||
@patch('issue_core.backends.gitea.backend.requests.Session')
|
||||
def test_test_connection_success(self, mock_session_class):
|
||||
"""Test test_connection method works correctly."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue