Refactor auth tests to use real communities, remove mocks#255
Conversation
Derive test origins and model values from loaded community configs instead of hardcoding them. Move discover_assistants() into a module-scoped fixture for better error reporting. Add helper functions for config access.
PR ReviewCode review found 2 important issues, both addressed in follow-up commit:
Test coverage review: All critical authorization paths covered (29 tests). Minor gaps identified (empty cors_origins path, community_config=None in select_api_key) are low severity (4-5/10) and the behavior is straightforward in those paths. |
Summary
MagicMock,@patch, andpatch.dictfrom authorization testsdiscover_assistants()at module levelmonkeypatch.setenv/delenvfor environment variable control (not mocking; real Settings reads them)_clear_settings_cacheautouse fixture to clear@lru_cachebetween teststest_cross_community_origins_not_sharedfor isolation verificationTest plan
Closes #85