mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
feat(2-A3b): requires_api_key enforcement in supervisor and GUI
- Add set_adapter_last_error method to ConfigStore for setting/clearing adapter error states - Add API key precondition check in supervisor._start_adapter that: - Checks if adapter has requires_api_key attribute - Looks up the key via config_store.get_api_key - Sets last_error and returns early if key is missing - Clears last_error when adapter successfully starts - Update adapters_list handler to compute api_key_missing flag for each adapter and pass to template - Update adapters_edit_form handler to compute api_key_missing and requires_api_key_alias for template context - Update adapters_list.html to show warning badge when api_key_missing - Update adapters_edit.html to show warning article and disable Enable checkbox when api_key_missing - Add tests for new functionality - Fix test mocks to include requires_api_key and last_error fields Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
43bf973caf
commit
045b8614e8
8 changed files with 222 additions and 19 deletions
|
|
@ -94,6 +94,8 @@ class MockConfigSource:
|
|||
class MockNWSAdapter:
|
||||
"""Mock NWSAdapter that tracks poll calls and allows control."""
|
||||
|
||||
requires_api_key = None # Mock adapters don't require API keys
|
||||
|
||||
def __init__(self, config, config_store, cursor_db_path) -> None:
|
||||
self.config = config
|
||||
self._config_store = config_store
|
||||
|
|
@ -152,6 +154,8 @@ def mock_config_store():
|
|||
store = MagicMock()
|
||||
store.list_streams = AsyncMock(return_value=[])
|
||||
store.get_stream = AsyncMock(return_value=None)
|
||||
store.set_adapter_last_error = AsyncMock()
|
||||
store.get_api_key = AsyncMock(return_value=None)
|
||||
return store
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue