mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-21 18:14:44 +02:00
refactor(gui): clean up flagged issues before merge
1. Make migration 015 idempotent with IF NOT EXISTS 2. Remove hardcoded cadence range from routes.py and template: - Added ge=10 constraint to AdapterConfig.cadence_s field - Removed manual 60-3600 check from routes.py POST handler - Validate cadence using AdapterConfig field metadata - Removed min/max attributes from template input 3. Move discover_adapters to its own module: - Created src/central/adapter_discovery.py - Updated supervisor.py to import from adapter_discovery - Updated routes.py to import from adapter_discovery - GUI no longer transitively imports nats or stream_manager 4. Remove dead code branch in form_descriptors.py: - Removed unreachable RegionConfig check (already handled earlier) - Improved error message for unsupported nested types 5. Updated test_adapters.py: - Changed invalid cadence test from 30 to 5 (below ge=10) - Updated assertion to check for "10" in error message Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bff6ccffff
commit
91f1d67abd
8 changed files with 51 additions and 42 deletions
|
|
@ -189,7 +189,7 @@ class TestAdaptersEditSubmit:
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_adapters_edit_invalid_cadence_shows_error(self):
|
||||
"""POST /adapters/nws with cadence_s=30 shows error, no DB update."""
|
||||
"""POST /adapters/nws with cadence_s=5 shows error, no DB update."""
|
||||
from central.gui.routes import adapters_edit_submit
|
||||
|
||||
mock_request = MagicMock()
|
||||
|
|
@ -199,7 +199,7 @@ class TestAdaptersEditSubmit:
|
|||
mock_form = MagicMock()
|
||||
mock_form.get.side_effect = lambda k, d="": {
|
||||
"csrf_token": "test_csrf_token",
|
||||
"cadence_s": "30",
|
||||
"cadence_s": "5",
|
||||
"contact_email": "test@example.com",
|
||||
"region_north": "49.0",
|
||||
"region_south": "24.0",
|
||||
|
|
@ -241,7 +241,7 @@ class TestAdaptersEditSubmit:
|
|||
call_args = mock_templates.TemplateResponse.call_args
|
||||
context = call_args.kwargs.get("context", call_args[1].get("context"))
|
||||
assert "cadence_s" in context["errors"]
|
||||
assert "60" in context["errors"]["cadence_s"] or "3600" in context["errors"]["cadence_s"]
|
||||
assert "10" in context["errors"]["cadence_s"]
|
||||
|
||||
|
||||
class TestAdaptersAudit:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue