Accept integration_id for api_call
All checks were successful
Container Image / build-and-push (push) Successful in 29s

This commit is contained in:
2026-07-08 11:14:53 +02:00
parent 3705a4817e
commit 2e0e1804de
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
import json
from unittest.mock import AsyncMock, patch
import pytest
@pytest.mark.asyncio
async def test_api_call_accepts_integration_id_alias():
from src.tools import system
integrations = [
{
"id": "f9909f22dc17",
"name": "Gitea",
"enabled": True,
"base_url": "https://git.example.test",
}
]
with (
patch("src.integrations.load_integrations", return_value=integrations),
patch("src.integrations.execute_api_call", new_callable=AsyncMock) as execute,
):
execute.return_value = {"output": "ok", "exit_code": 0}
result = await system.do_api_call(json.dumps({
"integration_id": "f9909f22dc17",
"method": "GET",
"path": "/api/v1/user/repos",
}))
assert result == {"output": "ok", "exit_code": 0}
execute.assert_awaited_once_with(
"f9909f22dc17",
"GET",
"/api/v1/user/repos",
params=None,
body=None,
extra_headers=None,
)