* feat: postgres tests

* feat: mongo cutoff

* feat: mongo cutoff

* feat: adjust docs and compose files

* fix: mini code mongo removals

* fix: tests and k8s mongo stuff

* feat: test fixes

* fix: ruff

* fix: vale

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix: mini suggestions

* vale lint fix 2

* fix: codeql columns thing

* fix: test mongo

* fix: tests coverage

* feat: better tests 4

* feat: more tests

* feat: decent coverage

* fix: ruff fixes

* fix: remove mongo mock

* feat: enhance workflow engine and API routes; add document retrieval and source handling

* feat: e2e tests

* fix: mcp, mongo and more

* fix: mini codeql warning

* fix: agent chunk view

* fix: mini issues

* fix: more pg fixes

* feat: postgres prep on start

* feat: qa tests

* fix: mini improvements

* fix: tests

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Siddhant Rai <siddhant.rai.5686@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-04-18 13:13:57 +01:00
1 parent 7f6360b4ff
commit 81b6ee5daa
312 files changed
+763725 -25159

No files matched your search

+49 -3
View File
@@ -28,20 +28,59 @@ class TestToolExecutorInit:
@pytest.mark.unit
class TestToolExecutorGetTools:
def test_get_tools_uses_api_key_when_present(self, mock_mongo_db):
@staticmethod
def _patch_conn(monkeypatch, pg_conn):
from contextlib import contextmanager
@contextmanager
def _use_pg_conn():
yield pg_conn
monkeypatch.setattr(
"application.agents.tool_executor.db_readonly", _use_pg_conn
)
def test_get_tools_uses_api_key_when_present(self, pg_conn, monkeypatch):
from application.storage.db.repositories.agents import AgentsRepository
from application.storage.db.repositories.user_tools import UserToolsRepository
tool = UserToolsRepository(pg_conn).create(user_id="alice", name="tool1")
AgentsRepository(pg_conn).create(
user_id="alice",
name="a",
status="active",
key="test_key",
tools=[str(tool["id"])],
)
self._patch_conn(monkeypatch, pg_conn)
executor = ToolExecutor(user_api_key="test_key", user="alice")
tools = executor.get_tools()
assert isinstance(tools, dict)
# The tool id should appear as key; tool_data['id'] is set
assert str(tool["id"]) in tools
assert tools[str(tool["id"])]["id"] == tool["id"]
def test_get_tools_uses_user_when_no_api_key(self, pg_conn, monkeypatch):
from application.storage.db.repositories.user_tools import UserToolsRepository
UserToolsRepository(pg_conn).create(
user_id="alice", name="tool1", status=True
)
self._patch_conn(monkeypatch, pg_conn)
def test_get_tools_uses_user_when_no_api_key(self, mock_mongo_db):
executor = ToolExecutor(user="alice")
tools = executor.get_tools()
assert isinstance(tools, dict)
assert len(tools) == 1
def test_get_tools_defaults_to_local(self, pg_conn, monkeypatch):
self._patch_conn(monkeypatch, pg_conn)
def test_get_tools_defaults_to_local(self, mock_mongo_db):
executor = ToolExecutor()
tools = executor.get_tools()
assert isinstance(tools, dict)
assert tools == {}
@pytest.mark.unit
@@ -346,6 +385,7 @@ class TestToolExecutorExecute:
tools_dict = {
"t1": {
"id": "00000000-0000-0000-0000-000000000001",
"name": "test_tool",
"config": {"key": "val"},
"actions": [
@@ -400,6 +440,7 @@ class TestToolExecutorExecute:
tools_dict = {
"t1": {
"id": "00000000-0000-0000-0000-000000000001",
"name": "test_tool",
"config": {"key": "val"},
"actions": [
@@ -489,6 +530,7 @@ class TestToolExecutorExecute:
tools_dict = {
"t1": {
"id": "00000000-0000-0000-0000-000000000001",
"name": "test_tool",
"config": {"key": "val"},
"actions": [
@@ -537,6 +579,7 @@ class TestToolExecutorExecute:
tools_dict = {
"t1": {
"id": "00000000-0000-0000-0000-000000000001",
"name": "test_tool",
"config": {"key": "val"},
"actions": [
@@ -582,6 +625,7 @@ class TestToolExecutorExecute:
)
tool_data = {
"id": "00000000-0000-0000-0000-000000000001",
"name": "custom_tool",
"config": {"encrypted_credentials": "encrypted_blob"},
}
@@ -605,6 +649,7 @@ class TestToolExecutorExecute:
)
tool_data = {
"id": "00000000-0000-0000-0000-000000000002",
"name": "mcp_tool",
"config": {},
}
@@ -642,6 +687,7 @@ class TestToolExecutorAdditionalCoverage:
tools_dict = {
"t1": {
"id": "00000000-0000-0000-0000-000000000001",
"name": "custom_tool",
"config": {"key": "val"},
"actions": [