Skip to content

ui, tests: fixed preferences tests broken by renames - #1679

Open
aadrian wants to merge 2 commits into
evilsocket:masterfrom
aadrian:tests-fix-preferences
Open

aadrian wants to merge 2 commits into
evilsocket:masterfrom
aadrian:tests-fix-preferences

Conversation

@aadrian

@aadrian aadrian commented Oct 5, 2026

Copy link
Copy Markdown

On master, 4 tests in ui/tests/dialogs/test_preferences.py fail. The cause is renames in the code, not bugs in the UI:

Test Cause Fix
test_save_ui_settings The events view saves its columns per table Read STATS_SHOW_COLUMNS + "_connections"
test_save_node_settings tabWidget is now stackedWidget, _node_needs_update is now node_needs_update Use the new names
test_action_deny_setting Config.ACTION_DENY_IDX no longer exists; the default action combo offers drop / allow / reject Now test_action_drop_setting, using ACTION_DROP_IDX
test_cancel_discards_changes Same missing ACTION_DENY_IDX Select an action different from the saved one, so the test actually checks that cancel discards it

Result: ui/tests goes from 94 passed / 4 failed to 98 passed, stable over repeated runs. Each fixed test also passes on its own.

This is based on #1678, because running the tests without it resets the settings of an installed UI. Only the last commit (ui, tests: fixed preferences tests broken by renames) is new here. If you prefer it independent of #1678, I can rebase it onto master.

The preferences tests delete ~/.config/opensnitch/settings.conf and write
it through QSettings, and pressing Apply calls Autostart.enable(), which
can create, remove or hide ~/.config/autostart/opensnitch_ui.desktop.
Running the suite on a machine with OpenSnitch installed therefore
replaced the user's real UI settings.

Redirect HOME and the XDG dirs to a temporary directory before opensnitch
is imported (utils/xdg.py caches the paths at import time), and add a
session fixture that fails if the paths resolve outside of it or if the
real settings.conf or autostart file changed during the run.
- the columns of the events view are saved per table
  (STATS_SHOW_COLUMNS + "_connections").
- the preferences sections are in stackedWidget, and the update flag
  is node_needs_update.
- the "deny" default action is now "drop" (ACTION_DROP_IDX).
- test_cancel_discards_changes: select an action different from the
  saved one, otherwise the test does not check anything.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant