Files
odysseus/tests/test_email_reader_handoff.py
T
pewdiepie-archdaemon 2e8413a54a Preserve preview harness, editor, email and task improvements
Snapshot current maintainer-preview application changes and regression fixtures for integration into lab. Excludes local runtime data, evaluation outputs and source backups. Focused Python regression selection: 140 passed; full suite not certified.
2026-10-01 01:34:26 +00:00

24 lines
1.1 KiB
Python

import pytest
from src.clean_agent_preview import email_reader_event
RESULT = {'stdout': '**Subject:** Weekly roundup\n**UID:** 162\n**Account:** Inbox (alex@example.com)\n'}
@pytest.mark.parametrize('prompt', ['open the weekly email', 'please open it', 'can you view that email'])
def test_explicit_open_uses_successful_read_identity(prompt):
assert email_reader_event(prompt, 'mcp__email__read_email', {'folder': 'Archive'}, RESULT) == {
'type': 'email_open', 'uid': '162', 'folder': 'Archive', 'account': 'alex@example.com'}
@pytest.mark.parametrize('prompt', ['summarize this email', 'read the weekly email', 'do not open it'])
def test_normal_read_does_not_open_reader(prompt):
assert email_reader_event(prompt, 'read_email', {}, RESULT) is None
def test_failed_or_unidentified_message_never_opens():
assert email_reader_event('open it', 'read_email', {}, RESULT, failed=True) is None
assert email_reader_event('open it', 'list_emails', {}, RESULT) is None
assert email_reader_event('open it', 'read_email', {'uid': '162'}, {'stdout': 'Not found'}) is None