Summary
Implement remaining integration tests for user auto-provisioning behavior during OAuth login flows. Test file scaffold exists but several tests are placeholders.
File
campus/tests/integration/auth/resources/test_user.py
Placeholder Tests to Implement
TestUsersResourceGetOrCreate class:
-
test_get_or_create_idempotent_multiple_calls (line 82-85)
- Verify that multiple calls with same email return the same user record
- Check that
created_at timestamps remain consistent across calls
-
test_new_creates_user_with_activated_at (line 87-90)
- Create user with explicit
activated_at timestamp
- Verify the timestamp is stored correctly
-
test_new_creates_user_without_activated_at (line 92-95)
- Create user without
activated_at
- Verify the field is null/None
TestUserResource class:
-
test_activate_sets_activated_at (line 145-148)
- Create a user without
activated_at
- Call
activate() on the user resource
- Verify
activated_at is now set
-
test_delete_removes_user (line 150-153)
- Create a user
- Call
delete() on the user resource
- Verify user is removed (should raise
NotFoundError on subsequent get)
Already Implemented
- ✅
test_get_or_create_creates_new_user_when_not_exists
- ✅
test_get_or_create_returns_existing_user_when_exists
- ✅
test_list_returns_all_users
Technical Notes
- Uses lazy imports to avoid storage initialization before test mode is configured (see AGENTS.md)
- Leverages
campus.storage.testing for test storage configuration
- Tests cover the auto-provisioning flow used during OAuth login
Summary
Implement remaining integration tests for user auto-provisioning behavior during OAuth login flows. Test file scaffold exists but several tests are placeholders.
File
campus/tests/integration/auth/resources/test_user.pyPlaceholder Tests to Implement
TestUsersResourceGetOrCreateclass:test_get_or_create_idempotent_multiple_calls(line 82-85)created_attimestamps remain consistent across callstest_new_creates_user_with_activated_at(line 87-90)activated_attimestamptest_new_creates_user_without_activated_at(line 92-95)activated_atTestUserResourceclass:test_activate_sets_activated_at(line 145-148)activated_atactivate()on the user resourceactivated_atis now settest_delete_removes_user(line 150-153)delete()on the user resourceNotFoundErroron subsequent get)Already Implemented
test_get_or_create_creates_new_user_when_not_existstest_get_or_create_returns_existing_user_when_existstest_list_returns_all_usersTechnical Notes
campus.storage.testingfor test storage configuration