test(e2e): wire OneDrive fake into harness

This commit is contained in:
Anish Sarkar 2026-05-08 03:48:35 +05:30
parent 3ee633cb23
commit da8b151634
3 changed files with 51 additions and 0 deletions

View file

@ -18,6 +18,8 @@ GMAIL_CANARY_SUBJECT = "E2E Canary Email"
GMAIL_CANARY_MESSAGE_ID = "fake-msg-canary-001"
CALENDAR_CANARY_TOKEN = "SURFSENSE_E2E_CANARY_TOKEN_CALENDAR_001"
CALENDAR_CANARY_SUMMARY = "E2E Canary Calendar Event"
ONEDRIVE_CANARY_TOKEN = "SURFSENSE_E2E_CANARY_TOKEN_ONEDRIVE_001"
ONEDRIVE_CANARY_FILE = "e2e-onedrive-canary.txt"
NOTION_CANARY_TOKEN = "SURFSENSE_E2E_CANARY_TOKEN_NOTION_001"
NOTION_CANARY_TITLE = "E2E Canary Notion Page"
CONFLUENCE_CANARY_TOKEN = "SURFSENSE_E2E_CANARY_TOKEN_CONFLUENCE_001"
@ -131,6 +133,10 @@ class FakeChatLLM(BaseChatModel):
latest_human,
("drive", "file", "e2e-canary.txt"),
)
wants_onedrive = _contains_any(
latest_human,
("onedrive", ONEDRIVE_CANARY_FILE, ONEDRIVE_CANARY_TOKEN),
)
wants_notion = _contains_any(
latest_human,
("notion", "page", NOTION_CANARY_TITLE),
@ -172,6 +178,11 @@ class FakeChatLLM(BaseChatModel):
or "fake-file-canary" in prompt_text
or DRIVE_CANARY_TOKEN in prompt_text
)
has_onedrive_evidence = (
ONEDRIVE_CANARY_FILE in prompt_text
or "fake-onedrive-canary" in prompt_text
or ONEDRIVE_CANARY_TOKEN in prompt_text
)
has_notion_evidence = (
NOTION_CANARY_TITLE in prompt_text or NOTION_CANARY_TOKEN in prompt_text
)
@ -215,6 +226,8 @@ class FakeChatLLM(BaseChatModel):
return f"Calendar content found: {CALENDAR_CANARY_TOKEN}"
if wants_gmail and has_gmail_evidence:
return f"Gmail content found: {GMAIL_CANARY_TOKEN}"
if wants_onedrive and has_onedrive_evidence:
return f"OneDrive content found: {ONEDRIVE_CANARY_TOKEN}"
if wants_drive and has_drive_evidence:
return f"Drive content found: {DRIVE_CANARY_TOKEN}"
if (
@ -225,6 +238,7 @@ class FakeChatLLM(BaseChatModel):
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Notion content found: {NOTION_CANARY_TOKEN}"
@ -236,6 +250,7 @@ class FakeChatLLM(BaseChatModel):
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Confluence content found: {CONFLUENCE_CANARY_TOKEN}"
@ -247,6 +262,7 @@ class FakeChatLLM(BaseChatModel):
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Jira content found: {JIRA_CANARY_TOKEN}"
@ -258,6 +274,7 @@ class FakeChatLLM(BaseChatModel):
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Linear content found: {LINEAR_CANARY_TOKEN}"
@ -269,6 +286,7 @@ class FakeChatLLM(BaseChatModel):
and not has_notion_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Calendar content found: {CALENDAR_CANARY_TOKEN}"
@ -279,9 +297,22 @@ class FakeChatLLM(BaseChatModel):
and not has_linear_evidence
and not has_notion_evidence
and not has_drive_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Gmail content found: {GMAIL_CANARY_TOKEN}"
if (
has_onedrive_evidence
and not has_confluence_evidence
and not has_jira_evidence
and not has_linear_evidence
and not has_notion_evidence
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_slack_evidence
):
return f"OneDrive content found: {ONEDRIVE_CANARY_TOKEN}"
if (
has_drive_evidence
and not has_confluence_evidence
@ -289,6 +320,7 @@ class FakeChatLLM(BaseChatModel):
and not has_linear_evidence
and not has_notion_evidence
and not has_gmail_evidence
and not has_onedrive_evidence
and not has_slack_evidence
):
return f"Drive content found: {DRIVE_CANARY_TOKEN}"
@ -301,6 +333,7 @@ class FakeChatLLM(BaseChatModel):
and not has_calendar_evidence
and not has_gmail_evidence
and not has_drive_evidence
and not has_onedrive_evidence
):
return f"Slack content found: {SLACK_CANARY_TOKEN}"
return NO_RELEVANT_CONTENT_SENTINEL

View file

@ -69,6 +69,12 @@ os.environ.setdefault(
"NOTION_REDIRECT_URI",
"http://localhost:8000/api/v1/auth/notion/connector/callback",
)
os.environ.setdefault("MICROSOFT_CLIENT_ID", "fake-microsoft-client-id")
os.environ.setdefault("MICROSOFT_CLIENT_SECRET", "fake-microsoft-client-secret")
os.environ.setdefault(
"ONEDRIVE_REDIRECT_URI",
"http://localhost:8000/api/v1/auth/onedrive/connector/callback",
)
os.environ["SLACK_CLIENT_ID"] = "fake-slack-mcp-client-id"
os.environ["SLACK_CLIENT_SECRET"] = "fake-slack-mcp-client-secret"
@ -106,6 +112,7 @@ from tests.e2e.fakes import ( # noqa: E402
mcp_runtime as _fake_mcp_runtime,
native_google as _fake_native_google,
notion_module as _fake_notion_module,
onedrive_graph as _fake_onedrive_graph,
slack_module as _fake_slack_module,
)
from tests.e2e.fakes.chat_llm import ( # noqa: E402
@ -125,6 +132,7 @@ def _patch_llm_bindings() -> None:
"app.tasks.connector_indexers.google_drive_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.google_gmail_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.notion_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.onedrive_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.local_folder_indexer.get_user_long_context_llm",
"app.tasks.document_processors._save.get_user_long_context_llm",
"app.tasks.document_processors.markdown_processor.get_user_long_context_llm",
@ -179,6 +187,7 @@ _fake_embeddings.install(_active_patches)
_fake_confluence_oauth.install(_active_patches)
_fake_confluence_indexer.install(_active_patches)
_fake_native_google.install(_active_patches)
_fake_onedrive_graph.install(_active_patches)
_fake_notion_module.install(_active_patches)
_fake_linear_module.install(_active_patches)
_fake_jira_module.install(_active_patches)

View file

@ -56,6 +56,12 @@ os.environ.setdefault(
"NOTION_REDIRECT_URI",
"http://localhost:8000/api/v1/auth/notion/connector/callback",
)
os.environ.setdefault("MICROSOFT_CLIENT_ID", "fake-microsoft-client-id")
os.environ.setdefault("MICROSOFT_CLIENT_SECRET", "fake-microsoft-client-secret")
os.environ.setdefault(
"ONEDRIVE_REDIRECT_URI",
"http://localhost:8000/api/v1/auth/onedrive/connector/callback",
)
os.environ["SLACK_CLIENT_ID"] = "fake-slack-mcp-client-id"
os.environ["SLACK_CLIENT_SECRET"] = "fake-slack-mcp-client-secret"
@ -91,6 +97,7 @@ from tests.e2e.fakes import ( # noqa: E402
mcp_runtime as _fake_mcp_runtime,
native_google as _fake_native_google,
notion_module as _fake_notion_module,
onedrive_graph as _fake_onedrive_graph,
slack_module as _fake_slack_module,
)
from tests.e2e.fakes.chat_llm import ( # noqa: E402
@ -109,6 +116,7 @@ def _patch_llm_bindings() -> None:
"app.tasks.connector_indexers.google_drive_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.google_gmail_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.notion_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.onedrive_indexer.get_user_long_context_llm",
"app.tasks.connector_indexers.local_folder_indexer.get_user_long_context_llm",
"app.tasks.document_processors._save.get_user_long_context_llm",
"app.tasks.document_processors.markdown_processor.get_user_long_context_llm",
@ -163,6 +171,7 @@ _fake_embeddings.install(_active_patches)
_fake_confluence_oauth.install(_active_patches)
_fake_confluence_indexer.install(_active_patches)
_fake_native_google.install(_active_patches)
_fake_onedrive_graph.install(_active_patches)
_fake_notion_module.install(_active_patches)
_fake_linear_module.install(_active_patches)
_fake_jira_module.install(_active_patches)