test(ldap): add login-flow × LDAP integration lane (cross-mode #980 guard) - #1053
Conversation
…uard) The `ldap` lane only exercised multi-user-BasicAuth mode (port 8003). Extend the GH #980 principal-resolution coverage to login-flow mode (port 8004), where identity comes via OIDC and Nextcloud API access via a per-user app password — a different path to the username used for DAV path construction. This proves BaseNextcloudClient._ensure_principal_id resolves the divergent LDAP loginName→UID regardless of deployment mode. - New `login_flow_ldap` pytest marker (dedicated → existing `login_flow` and `ldap` lanes stay zero-touch; verified via --collect-only). - New test tests/server/login_flow/test_ldap_dav_principal.py mirroring the multi-user-basic WebDAV round-trip, driven via Login Flow v2 as the LDAP alice. - New fixture nc_mcp_login_flow_ldap_alice_client reusing the existing _get_login_flow_token_for_user / _provision_login_flow_mcp_client helpers (no test_users_setup coupling — alice is user_ldap-provisioned on first login). - New CI matrix lane `login-flow-ldap` (profile login-flow + `--profile ldap`, playwright, port 8004); Verify-LDAP-backend and Verify-OIDC steps extended to the new mode. - CLAUDE.md: document both LDAP lanes; correct the stale xfail note (#980's fix has landed → both are passing guards). - Incidental: add `assert ... is not None` narrowing after existing pytest.skip guards in login_flow/conftest.py so the ty-check pre-commit hook passes on the touched file (ty doesn't treat pytest.skip as NoReturn; these were pre-existing errors surfaced by editing the file). Refs: Deck #617 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @cbcoutinho's task in 2m 28s —— View job Review: PR #1053 — login-flow × LDAP integration lane
SummaryThis is a well-scoped, low-risk test-infrastructure PR. It closely mirrors the existing What I checked
Minor observations (non-blocking)
No blocking issues found. |
pytest -m matches marker names exactly, so the single-user lane's `... and not login_flow and not ldap` did NOT exclude a test marked only `login_flow_ldap`. With testpaths=["tests"] and no path filter, the new test/server/login_flow/test_ldap_dav_principal.py (integration + login_flow_ldap) was collected and selected by the single-user lane, which has no login-flow service, no ldap profile, and needs-playwright: false — so the browser fixture errored and failed single-user CI. Add `and not login_flow_ldap` to both disjuncts of the single-user markers expression. Verified via --collect-only that the single-user expression now selects 0 of the new test while the login_flow_ldap lane still selects it. Caught by the claude[bot] review on #1053. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Round-1 findings addressed in
Left as-is:
New CI run triggered by the push (the |
|



What
The
ldapCI lane only exercised multi-user-BasicAuth mode (port 8003) as the divergent LDAP useralice(loginName ≠ UID, GH #980 regression guard). This adds a second lane that exercises the same principal-resolution behaviour in login-flow mode (port 8004), where identity comes via OIDC and Nextcloud API access via a per-user app password — a different path to the username used for DAV path construction.It proves
BaseNextcloudClient._ensure_principal_idresolves the divergent LDAP loginName→UID regardless of deployment mode.Changes
login_flow_ldappytest marker — dedicated so the existinglogin_flowandldaplanes stay zero-touch (verified via--collect-only:-m login_flowand-m ldapboth exclude the new test).tests/server/login_flow/test_ldap_dav_principal.pymirroring the multi-user-basic WebDAV create→write→read→list→delete round-trip, driven via Login Flow v2 as the LDAPalice.nc_mcp_login_flow_ldap_alice_clientreusing the existing_get_login_flow_token_for_user/_provision_login_flow_mcp_clienthelpers — notest_users_setupcoupling (alice is user_ldap-provisioned on first login).login-flow-ldap(profilelogin-flow+--profile ldap, playwright, port 8004);Verify LDAP backendandVerify OIDC configurationsteps extended to the new mode.CLAUDE.md: document both LDAP lanes and correct the stalexfailnote (fix(client): resolve DAV paths via current-user-principal discovery #980's fix has landed → both are passing guards).assert ... is not Nonenarrowing after the existingpytest.skipguards inlogin_flow/conftest.pyso thety-checkpre-commit hook passes on the touched file (ty doesn't treatpytest.skipasNoReturn; these were pre-existing errors surfaced by editing the file — CI'sty check -- nextcloud_mcp_servernever covered them).Verified locally (end-to-end, not just static)
Ran the full stack (
--profile ldap --profile login-flow) and the new lane against it:Confirmed the test is meaningful: LDAP
alicelogs in asalicebut her canonical UID is57da83ba-0fda-1041-...(entryUUID-derived, her real home dir on disk). The round-trip succeeds only because principal discovery rewrites/files/alice/→/files/57da83ba-.../. Investigation result: login-flow mode works correctly with the LDAP backend.Test coverage
This PR is test-tier + CI config + docs — no product API surface changes, so the e2e+contract review gate is not triggered. It adds integration coverage (a new full-stack lane).
Tracking: Deck card #617 (board 12 — nextcloud-mcp-server Product).
This PR was generated with the help of AI, and reviewed by a Human
🤖 Generated with Claude Code