mirror of
https://github.com/searxng/searxng.git
synced 2025-12-24 04:30:02 +00:00
[refactor] refactor SwitchableSetting
The previous implementation used two hash sets and a list. ... that's not necessary ... a single hash map suffices. And it's also less error prone ... because the previous data structure allowed a setting to be enabled and disabled at the same time.
This commit is contained in:
@@ -105,14 +105,14 @@ class TestSettings(SearxTestCase):
|
||||
plugin1 = PluginStub('plugin1', True)
|
||||
plugin2 = PluginStub('plugin2', True)
|
||||
setting = PluginsSetting(['3'], plugins=[plugin1, plugin2])
|
||||
self.assertEqual(setting.get_enabled(), set(['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', plugins=[plugin1, plugin2, plugin3])
|
||||
self.assertEqual(setting.get_enabled(), set(['plugin1', 'plugin3']))
|
||||
self.assertEqual(set(setting.get_enabled()), set(['plugin1', 'plugin3']))
|
||||
|
||||
|
||||
class TestPreferences(SearxTestCase):
|
||||
|
||||
Reference in New Issue
Block a user