MCPcopy
hub / github.com/freedomofpress/dangerzone / test_new_settings_added

Function test_new_settings_added

tests/test_settings.py:92–108  ·  view source on GitHub ↗
(tmp_path: Path, mocker: MockerFixture)

Source from the content-addressed store, hash-verified

90
91
92def test_new_settings_added(tmp_path: Path, mocker: MockerFixture) -> None:
93 settings = Settings()
94
95 # Add new setting
96 settings.set("new_setting_autosaved", 20, autosave=True)
97 settings.set(
98 "new_setting", 10
99 ) # XXX has to be afterwards; otherwise this will be saved
100
101 # Simulate new app startup (settings recreation)
102 Settings._singleton = None
103 settings2 = Settings()
104
105 # Check if new setting persisted
106 assert 20 == settings2.get("new_setting_autosaved")
107 with pytest.raises(KeyError):
108 settings2.get("new_setting")
109
110
111def test_output_dir_default_is_none(tmp_path: Path, mocker: MockerFixture) -> None:

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
getMethod · 0.95
SettingsClass · 0.90

Tested by

no test coverage detected