HERMES-GIELIE/tests/test_issue1139_password_remote.py
nesquena-hermes 8b8ff3328a
fix: batch triage — 12 contributor PRs (v0.50.227) (#1168)
Merged as v0.50.227. 2634 tests passing, browser QA 21/21 (desktop + mobile). Full attribution below.

Thanks to all 12 contributors:
@jundev0001 (#1138), @franksong2702 (#1142, #1157, #1162), @dso2ng (#1143), @bergeouss (#1145, #1146, #1156, #1159), @jasonjcwu (#1149), @ccqqlo (#1161), @frap129 (#1165)

Two fixes applied during integration and two more by the independent reviewer (@nesquena):
- messages.js: per-turn cost delta capture order (#1159)
- workspace.py: symlink target blocked-roots check + HOME sanity guard (#1149, #1165)
- panels.js: cron unread counter bookkeeping (in-loop increment bug)
- tests/test_symlink_cycle_detection.py: register workspace before session/new
2026-04-27 13:34:59 -07:00

79 lines
3.1 KiB
Python

"""Tests for issue #1139 — Password change/remove broken remotely.
Root cause: the System settings pane (settingsPaneSystem) had no Save Settings button.
Users in Settings > System could type a new password but had no way to submit it.
Disable Auth and Sign Out buttons existed but Save was missing.
"""
import pytest
def test_system_pane_has_save_button():
"""The System settings pane must include a Save Settings button."""
with open('static/index.html') as f:
html = f.read()
# Find the System pane block (last pane, so search until parent close)
start = html.index('id="settingsPaneSystem"')
# The parent container closes after all panes
end_marker = '</div>\n </div>\n </div>' # pane + panes container + settings panel
end = html.index(end_marker, start) + len(end_marker)
pane_block = html[start:end]
assert 'saveSettings()' in pane_block, \
'System pane must contain a Save Settings button (onclick="saveSettings()")'
def test_system_pane_has_password_field_and_auth_buttons():
"""System pane should have password field, Disable Auth, and Sign Out buttons."""
with open('static/index.html') as f:
html = f.read()
start = html.index('id="settingsPaneSystem"')
end_marker = '</div>\n </div>\n </div>'
end = html.index(end_marker, start) + len(end_marker)
pane_block = html[start:end]
assert 'settingsPassword' in pane_block, 'Password field missing from System pane'
assert 'btnDisableAuth' in pane_block, 'Disable Auth button missing from System pane'
assert 'btnSignOut' in pane_block, 'Sign Out button missing from System pane'
def test_save_settings_sends_password():
"""saveSettings() must read settingsPassword and send _set_password."""
with open('static/panels.js') as f:
src = f.read()
assert 'settingsPassword' in src, 'saveSettings should read settingsPassword'
assert '_set_password' in src, 'saveSettings should send _set_password key'
def test_disable_auth_sends_clear_password():
"""disableAuth() must send _clear_password: true."""
with open('static/panels.js') as f:
src = f.read()
assert '_clear_password:true' in src, 'disableAuth should send _clear_password: true'
def test_all_settings_panes_have_save_button():
"""All settings panes that have user-editable fields should have a Save button."""
with open('static/index.html') as f:
html = f.read()
import re
# Find all settings panes
panes = re.findall(
r'<div class="settings-pane" id="(settingsPane\w+)"[^>]*>(.*?)</div>\s*</div>',
html, re.DOTALL
)
for pane_id, pane_html in panes:
# Providers pane doesn't need a Save button (has per-provider save)
if pane_id == 'settingsPaneProviders':
continue
# Check if pane has any input fields (not just buttons)
has_inputs = bool(re.search(r'<input|<select|<textarea', pane_html))
if has_inputs:
assert 'saveSettings()' in pane_html, \
f'{pane_id} has input fields but no Save Settings button'