Skip to content

fix(connect): use the real server_settings/mail/test endpoint - #760

Draft
ian-flores wants to merge 1 commit into
mainfrom
fix-connect-send-test-email-751
Draft

ian-flores wants to merge 1 commit into
mainfrom
fix-connect-send-test-email-751

Conversation

@ian-flores

Copy link
Copy Markdown
Collaborator

Fixes #751.

test_send_email 404ed because ConnectClient.send_test_email called POST /api/v1/tasks/send-test-email, which Connect has never had. It has been in VIP since the initial scaffold, so the scenario has likely never passed. The Connect admin UI's "Send Test Email" button uses GET /api/server_settings/mail/test, which this PR switches to.

  • send_test_email() now does GET /api/server_settings/mail/test and returns None. The endpoint takes no parameters, sends to the API key owner's address, requires an administrator key, and returns an empty 200 (text/plain), so the old to argument and JSON return value are gone.
  • The scenario skips when the API user is not an administrator or has no email address, and the Then step is now "the test email is accepted by Connect" (there is no task to complete).
  • Added selftests for the request method and path and for a 4xx raising HTTPStatusError.

The second half of the traceback in #751 (list_vip_content failing on a bare array) was already fixed by #748.

Notes: the route is marked internal in Connect's OpenAPI, so it is not part of the documented public API, though the admin UI depends on it. This was verified against the Connect source, not against a live server, so I would appreciate a run against Connect 2026.09.0 from the reporter.

send_test_email called POST /__api__/v1/tasks/send-test-email, which does not exist in Connect (it 404s on 2026.09.0, and the path is absent from the Connect source at v2022.02.0, v2024.12.0 and v2026.09.0). The Connect admin UI's "Send Test Email" button uses GET /__api__/server_settings/mail/test, so call that instead.

The endpoint takes no parameters, sends to the API key owner's address, requires an administrator key, and returns an empty 200 on success. send_test_email therefore no longer takes a recipient or returns a body. The scenario now skips when the API user is not an administrator or has no email address, and asserts the request is accepted. Selftests cover the request path and an error status.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new prerequisite branches incorrectly report an unperformed configured check as not applicable.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Corrects Connect test-email requests to use the endpoint exercised by the admin UI.

Changes:

  • Switches to GET /server_settings/mail/test.
  • Updates the BDD scenario for synchronous acceptance.
  • Adds request-path and HTTP-error selftests.
File Description
src/​vip/​clients/​connect.py Uses the correct test-email endpoint.
src/​vip_tests/​connect/​test_email.py Updates prerequisites and acceptance handling.
src/​vip_tests/​connect/​test_email.feature Revises the expected outcome.
selftests/​test_clients_connect.py Tests request routing and error propagation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +25 to 28
if user.get("user_role") != "administrator":
pytest.skip("Sending a test email requires an administrator API key")
if not user.get("email"):
pytest.skip("Current API user has no email address configured")
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
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.

[Bug] test_send_email test fails with 404 when testing email from UI works

2 participants