|
@@ -5,8 +5,8 @@ from searx.testing import SearxTestCase
|
|
|
|
|
|
class PluginStub:
|
|
|
|
|
|
- def __init__(self, id, default_on):
|
|
|
- self.id = id
|
|
|
+ def __init__(self, plugin_id, default_on):
|
|
|
+ self.id = plugin_id
|
|
|
self.default_on = default_on
|
|
|
|
|
|
|
|
@@ -15,11 +15,11 @@ class TestSettings(SearxTestCase):
|
|
|
|
|
|
def test_map_setting_invalid_initialization(self):
|
|
|
with self.assertRaises(MissingArgumentException):
|
|
|
- setting = MapSetting(3, wrong_argument={'0': 0})
|
|
|
+ MapSetting(3, wrong_argument={'0': 0})
|
|
|
|
|
|
def test_map_setting_invalid_default_value(self):
|
|
|
with self.assertRaises(ValidationException):
|
|
|
- setting = MapSetting(3, map={'dog': 1, 'bat': 2})
|
|
|
+ MapSetting(3, map={'dog': 1, 'bat': 2})
|
|
|
|
|
|
def test_map_setting_invalid_choice(self):
|
|
|
setting = MapSetting(2, map={'dog': 1, 'bat': 2})
|
|
@@ -36,18 +36,14 @@ class TestSettings(SearxTestCase):
|
|
|
setting.parse('bat')
|
|
|
self.assertEqual(setting.get_value(), 2)
|
|
|
|
|
|
- def test_enum_setting_invalid_initialization(self):
|
|
|
- with self.assertRaises(MissingArgumentException):
|
|
|
- setting = EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
|
|
-
|
|
|
# enum settings
|
|
|
def test_enum_setting_invalid_initialization(self):
|
|
|
with self.assertRaises(MissingArgumentException):
|
|
|
- setting = EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
|
|
+ EnumStringSetting('cat', wrong_argument=[0, 1, 2])
|
|
|
|
|
|
def test_enum_setting_invalid_default_value(self):
|
|
|
with self.assertRaises(ValidationException):
|
|
|
- setting = EnumStringSetting(3, choices=[0, 1, 2])
|
|
|
+ EnumStringSetting(3, choices=[0, 1, 2])
|
|
|
|
|
|
def test_enum_setting_invalid_choice(self):
|
|
|
setting = EnumStringSetting(0, choices=[0, 1, 2])
|
|
@@ -67,11 +63,11 @@ class TestSettings(SearxTestCase):
|
|
|
# multiple choice settings
|
|
|
def test_multiple_setting_invalid_initialization(self):
|
|
|
with self.assertRaises(MissingArgumentException):
|
|
|
- setting = MultipleChoiceSetting(['2'], wrong_argument=['0', '1', '2'])
|
|
|
+ MultipleChoiceSetting(['2'], wrong_argument=['0', '1', '2'])
|
|
|
|
|
|
def test_multiple_setting_invalid_default_value(self):
|
|
|
with self.assertRaises(ValidationException):
|
|
|
- setting = MultipleChoiceSetting(['3', '4'], choices=['0', '1', '2'])
|
|
|
+ MultipleChoiceSetting(['3', '4'], choices=['0', '1', '2'])
|
|
|
|
|
|
def test_multiple_setting_invalid_choice(self):
|
|
|
setting = MultipleChoiceSetting(['1', '2'], choices=['0', '1', '2'])
|