Files
kamidso-back/tests/kamidso/test_kamidso_file_bridge.py
javadandCursor b93ecf1691 Initial commit of the Kamidso API.
Keep source, config, and deploy files. Leave runtime data, uploads, and logs out of git.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-10 13:43:09 +03:30

60 lines
1.8 KiB
Python

from kamidso.engine.app.openapi.api_v1.agentic_data_api import (
_has_attached_files,
_kamidso_file_context,
_this_turn_source_section,
)
def test_kamidso_file_context_injects_resolved_paths():
ctx = _kamidso_file_context(
{
"kamidso_resolved_file_paths": [
r"F:\kamidso\uploads\usr_x\Book1.xlsx"
]
}
)
assert "User Uploaded Files" in ctx
assert "Book1.xlsx" in ctx
assert "Never ask the user to paste" in ctx
def test_kamidso_file_context_marks_every_resolved_path_as_attached():
ctx = _kamidso_file_context(
{
"kamidso_resolved_file_paths": [
r"F:\kamidso\data\runtime\run_x\input\employees.xlsx",
r"F:\kamidso\data\runtime\run_x\input\Book1.xlsx",
]
}
)
assert "employees.xlsx" in ctx
assert "Book1.xlsx" in ctx
assert "Every path listed here is attached to this turn" in ctx
def test_has_attached_files_from_kamidso_paths():
assert _has_attached_files(
attachment_ctx=None,
ext_info={"kamidso_resolved_file_paths": ["/tmp/a.xlsx"]},
file_path=None,
)
def test_this_turn_source_prefers_database_over_history_excel():
section = _this_turn_source_section(
database_name="sqlite_Walmart_Sales",
database_label="SQLite",
has_files=False,
)
assert "database()" in section
assert "code_interpreter" in section
assert "Book1.xlsx" in section
assert "mandatory" in section.lower()
def test_this_turn_source_without_file_or_database_forbids_leftover_excel():
section = _this_turn_source_section(has_files=False)
assert "No file or database is attached" in section
assert "data/runtime" in section
assert "question" in section