mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-08-03 07:22:44 +02:00
Add test for radio config settings fallback coverage
Exercise the else branches in create_app() where radio params fall back to WebSettings defaults when passed as None.
This commit is contained in:
@@ -250,6 +250,36 @@ class TestCheckApiAccess:
|
||||
)
|
||||
|
||||
|
||||
class TestRadioConfigSettingsFallback:
|
||||
"""Tests that radio config falls back to settings when params are None."""
|
||||
|
||||
def test_radio_params_fall_back_to_settings(
|
||||
self, mock_http_client: MockHttpClient, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Radio config uses settings defaults when no CLI params are passed."""
|
||||
monkeypatch.setenv("OIDC_ENABLED", "false")
|
||||
monkeypatch.setenv("NETWORK_ANNOUNCEMENT", "")
|
||||
app = create_app(
|
||||
api_url="http://localhost:8000",
|
||||
api_key="test-api-key",
|
||||
network_radio_profile=None,
|
||||
network_radio_frequency=None,
|
||||
network_radio_bandwidth=None,
|
||||
network_radio_spreading_factor=None,
|
||||
network_radio_coding_rate=None,
|
||||
network_radio_tx_power=None,
|
||||
features=ALL_FEATURES_ENABLED,
|
||||
)
|
||||
app.state.http_client = mock_http_client
|
||||
|
||||
assert app.state.network_radio_profile == "EU/UK Narrow"
|
||||
assert app.state.network_radio_frequency == 869.618
|
||||
assert app.state.network_radio_bandwidth == 62.5
|
||||
assert app.state.network_radio_spreading_factor == 8
|
||||
assert app.state.network_radio_coding_rate == 8
|
||||
assert app.state.network_radio_tx_power == 22.0
|
||||
|
||||
|
||||
class TestFlashBannerVisibility:
|
||||
"""Tests for the network announcement flash banner visibility."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user