Skip to content

Add functional tests for per-message export (happy path + auth/ownership failures)#786

Merged
eldong merged 2 commits intoexport-messagefrom
copilot/sub-pr-783-again
Mar 10, 2026
Merged

Add functional tests for per-message export (happy path + auth/ownership failures)#786
eldong merged 2 commits intoexport-messagefrom
copilot/sub-pr-783-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Review feedback on #783 requested a standalone functional test script covering the per-message export flows (client-side Markdown + Word backend), including at least one happy path and a basic auth/ownership failure case.

Added: functional_tests/test_per_message_export.py

  • Happy path – Word export: constructs a .docx from a valid message/conversation pair, verifies non-empty output and round-trip heading presence; skips gracefully if python-docx is absent
  • Happy path – Markdown export: validates the formatted output (### Role, *timestamp*, content) matching the client-side logic in chat-message-export.js
  • Auth failure: None/empty user_id → 401 "User not authenticated"
  • Ownership failure – wrong user: caller requesting another user's conversation → 403 "Access denied"
  • Ownership failure – missing conversation: Cosmos lookup returns nothing → 404 "Conversation not found"
  • Content normalisation: covers all three input shapes (plain string, list of content-part dicts, single dict) including image_url entries rendering as [Image]
  • Markdown without timestamp: confirms the *timestamp* line is suppressed when absent

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ownership failures)

Co-authored-by: eldong <11573590+eldong@users.noreply.github.com>
@eldong eldong marked this pull request as ready for review March 10, 2026 15:00
@eldong eldong merged commit 817aecd into export-message Mar 10, 2026
2 checks passed
@eldong eldong deleted the copilot/sub-pr-783-again branch March 10, 2026 15:00
Copilot AI restored the copilot/sub-pr-783-again branch March 10, 2026 15:00
Copilot AI changed the title [WIP] Add functional test script for export feature Add functional tests for per-message export (happy path + auth/ownership failures) Mar 10, 2026
Copilot stopped work on behalf of eldong due to an error March 10, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants