second_auth_user fixture uses user2_ handle prefix to prevent collisions with auth_user's testuser_ prefix
_make_doc() helper inserts Document row directly via ORM (no upload endpoint) — same pattern as test_documents.py
pytestmark = pytest.mark.asyncio at module level replaces per-test decorators — consistent with other test files
duration
completed_date
tasks_completed
tasks_total
files_modified
~15 minutes
2026-05-30
2
2
2
Phase 6.1 Plan 01: Promote test_shares.py stubs to real tests (SHARE-01..05) Summary
One-liner: Seven xfail stubs replaced with real integration tests that exercise POST/GET/DELETE /api/shares via in-memory SQLite, plus a second_auth_user fixture enabling sharer/recipient scenarios.
Added @pytest_asyncio.fixture async def second_auth_user(db_session) immediately after auth_user. The fixture creates a second User with handle prefix user2_ and email user2_{hex8}@example.com, plus a Quota row with limit_bytes=100MB and used_bytes=0. Returns the same {user, token, headers} dict shape as auth_user. This fixture enables sharing tests that need a distinct sharer and recipient within the same test case.
Task 2 — Real tests in test_shares.py
Completely rewrote backend/tests/test_shares.py:
Removed: all 7 @pytest.mark.xfail(strict=False) decorators, all 7 pytest.xfail("not implemented yet") calls, import os (was unused)
Added: pytestmark = pytest.mark.asyncio, import uuid as _uuid, import pytest_asyncio
Added: async def _make_doc(db_session, owner_user) helper that inserts an uploaded Document row via ORM and returns str(doc_id)
Implemented 7 real tests:
Test
Requirement
Assertion
test_share_success
SHARE-01
POST 201, body has id/document_id/recipient_id; recipient sees doc in /received
test_share_handle_not_found
SHARE-01
POST with nonexistent handle → 404
test_shared_with_me
SHARE-02
/received has required fields; extracted_text absent (T-04-04-03); owner_handle correct
test_share_no_quota_impact
SHARE-03
Recipient /quota used_bytes == 0 after share (T-04-04-04)
test_revoke_share
SHARE-04
DELETE 204; doc no longer in recipient /received
test_share_revoke_wrong_owner_404
SHARE-04
Recipient DELETE → 404 not 403 (IDOR protection T-04-04-02)
Result: 7 passed, 0 failed, 0 xfailed, 0 xpassed (verified in Docker with pytest 9.0.3, asyncio mode=AUTO).
Deviations from Plan
None — plan executed exactly as written. The second_auth_user fixture was added to the worktree conftest.py at the exact position specified (after auth_user, before admin_user). All 7 tests match the plan spec.
Known Stubs
None. All 7 tests have real assertions against the live API.
Threat Flags
None. No new network endpoints, auth paths, file access patterns, or schema changes introduced. This plan is test-only.
Self-Check: PASSED
backend/tests/conftest.py contains second_auth_user fixture at line 229
backend/tests/test_shares.py has zero pytest.xfail calls
backend/tests/test_shares.py has zero @pytest.mark.xfail decorators
import os is absent from test_shares.py
pytestmark = pytest.mark.asyncio is present at module level