forked from Icycoide/searxng
[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:
parent
56fbf22108
commit
180d4d068b
2 changed files with 33 additions and 51 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue