mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 11:26:25 -05:00
Hotspot: address review comments.
* POST /api/hotspot/settings checks is_docker_mode() directly instead of string-matching the error message (still 500, matching the sibling hotspot/bluetooth/throttle endpoints). * Escape \ ; , " in the WiFi QR code per the WPA QR format. * Skip the controller.yaml write when a settings update changes nothing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0d2c13e4e7
commit
2887309aae
4 changed files with 27 additions and 8 deletions
|
|
@ -404,6 +404,17 @@ class TestUpdateHotspotSettings:
|
|||
assert result["success"] is False
|
||||
assert "Docker" in result["error"]
|
||||
|
||||
def test_noop_does_not_save(self, tmp_path, reset_runtime_config):
|
||||
"""An empty update succeeds without writing controller.yaml."""
|
||||
missing_path = tmp_path / 'missing' / 'controller.yaml'
|
||||
with mock.patch("controller.lib.admin.is_docker_mode", return_value=False):
|
||||
# save_config() would raise RuntimeError here; success proves it was skipped.
|
||||
with mock.patch("controller.lib.config.CONFIG_PATH_ON_DRIVE", missing_path):
|
||||
result = update_hotspot_settings()
|
||||
|
||||
assert result["success"] is True
|
||||
assert not missing_path.exists()
|
||||
|
||||
def test_error_when_drive_not_mounted(self, tmp_path, reset_runtime_config):
|
||||
"""Saving fails cleanly when the primary drive is not mounted."""
|
||||
missing_path = tmp_path / 'missing' / 'controller.yaml'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue