diff options
author | Martin Fischer <martin@push-f.com> | 2022-01-07 09:45:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 09:45:23 +0100 |
commit | e12525a1fabef37dbaf5e75bc143787ba626b43f (patch) | |
tree | 963ca5ae8188342b7a178cc0d96d9c0311f38050 /tests/unit | |
parent | a583d09582a49d552c3dd1259f78c1c56427bb89 (diff) | |
parent | 180d4d068b4c629ab99876b55046f98455b88149 (diff) | |
download | searxng-e12525a1fabef37dbaf5e75bc143787ba626b43f.tar.gz searxng-e12525a1fabef37dbaf5e75bc143787ba626b43f.zip |
Merge pull request #708 from not-my-profile/pref-refactor
Refactor `preferences`
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/test_preferences.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/tests/unit/test_preferences.py b/tests/unit/test_preferences.py index 1ffed5c1a..a69c45178 100644 --- a/tests/unit/test_preferences.py +++ b/tests/unit/test_preferences.py @@ -1,7 +1,6 @@ from searx.preferences import ( EnumStringSetting, MapSetting, - MissingArgumentException, SearchLanguageSetting, MultipleChoiceSetting, PluginsSetting, @@ -19,10 +18,6 @@ class PluginStub: class TestSettings(SearxTestCase): # map settings - def test_map_setting_invalid_initialization(self): - with self.assertRaises(MissingArgumentException): - MapSetting(3, wrong_argument={'0': 0}) - def test_map_setting_invalid_default_value(self): with self.assertRaises(ValidationException): MapSetting(3, map={'dog': 1, 'bat': 2}) @@ -43,9 +38,6 @@ class TestSettings(SearxTestCase): self.assertEqual(setting.get_value(), 2) # enum settings - def test_enum_setting_invalid_initialization(self): - with self.assertRaises(MissingArgumentException): - EnumStringSetting('cat', wrong_argument=[0, 1, 2]) def test_enum_setting_invalid_default_value(self): with self.assertRaises(ValidationException): @@ -67,9 +59,6 @@ class TestSettings(SearxTestCase): self.assertEqual(setting.get_value(), 2) # multiple choice settings - def test_multiple_setting_invalid_initialization(self): - with self.assertRaises(MissingArgumentException): - MultipleChoiceSetting(['2'], wrong_argument=['0', '1', '2']) def test_multiple_setting_invalid_default_value(self): with self.assertRaises(ValidationException): @@ -115,15 +104,15 @@ class TestSettings(SearxTestCase): def test_plugins_setting_all_default_enabled(self): plugin1 = PluginStub('plugin1', True) plugin2 = PluginStub('plugin2', True) - setting = PluginsSetting(['3'], choices=[plugin1, plugin2]) - self.assertEqual(setting.get_enabled(), set(['plugin1', 'plugin2'])) + setting = PluginsSetting(['3'], plugins=[plugin1, plugin2]) + self.assertEqual(set(setting.get_enabled()), set(['plugin1', 'plugin2'])) def test_plugins_setting_few_default_enabled(self): plugin1 = PluginStub('plugin1', True) plugin2 = PluginStub('plugin2', False) plugin3 = PluginStub('plugin3', True) - setting = PluginsSetting('name', choices=[plugin1, plugin2, plugin3]) - self.assertEqual(setting.get_enabled(), set(['plugin1', 'plugin3'])) + setting = PluginsSetting('name', plugins=[plugin1, plugin2, plugin3]) + self.assertEqual(set(setting.get_enabled()), set(['plugin1', 'plugin3'])) class TestPreferences(SearxTestCase): |