diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_robot.py | 23 | ||||
| -rw-r--r-- | tests/unit/test_plugins.py | 4 | ||||
| -rw-r--r-- | tests/unit/test_preferences.py | 20 | ||||
| -rw-r--r-- | tests/unit/test_webapp.py | 2 |
4 files changed, 11 insertions, 38 deletions
diff --git a/tests/test_robot.py b/tests/test_robot.py deleted file mode 100644 index b48153fe4..000000000 --- a/tests/test_robot.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import unittest2 as unittest -from plone.testing import layered -from robotsuite import RobotTestSuite -from searx.testing import SEARXROBOTLAYER - - -def test_suite(): - suite = unittest.TestSuite() - current_dir = os.path.abspath(os.path.dirname(__file__)) - robot_dir = os.path.join(current_dir, 'robot') - tests = [ - os.path.join('robot', f) for f in - os.listdir(robot_dir) if f.endswith('.robot') and - f.startswith('test_') - ] - for test in tests: - suite.addTests([ - layered(RobotTestSuite(test), layer=SEARXROBOTLAYER), - ]) - return suite diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py index 969630c40..9ef4cd692 100644 --- a/tests/unit/test_plugins.py +++ b/tests/unit/test_plugins.py @@ -31,10 +31,10 @@ class PluginStoreTest(SearxTestCase): request = Mock() store.call([], 'asdf', request, Mock()) - self.assertFalse(testplugin.asdf.called) + self.assertFalse(testplugin.asdf.called) # pylint: disable=E1101 store.call([testplugin], 'asdf', request, Mock()) - self.assertTrue(testplugin.asdf.called) + self.assertTrue(testplugin.asdf.called) # pylint: disable=E1101 class SelfIPTest(SearxTestCase): diff --git a/tests/unit/test_preferences.py b/tests/unit/test_preferences.py index bee436027..510d4985a 100644 --- a/tests/unit/test_preferences.py +++ b/tests/unit/test_preferences.py @@ -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']) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 75a968ad8..ac8851e33 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -145,7 +145,7 @@ class ViewsTestCase(SearxTestCase): result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) self.assertEqual(result.status_code, 308) - def test_index_rss(self): + def test_search_rss(self): result = self.app.post('/search', data={'q': 'test', 'format': 'rss'}) self.assertIn( |