summaryrefslogtreecommitdiff
path: root/tests/unit/test_plugins.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-10-10 09:16:00 +0200
committerGitHub <noreply@github.com>2021-10-10 09:16:00 +0200
commitf5755ba6b98856c27c0b77af1aafb704733b8128 (patch)
tree259bf5b4d07cfa82914cbd572d799148687bba18 /tests/unit/test_plugins.py
parent878d5d657c1064762da70b03b488517a2b82e759 (diff)
parent5731b6b700f648bef71fc217a2ae3911d26790f4 (diff)
Merge pull request #319 from dalf/mod-plugins
plugins: refactor initialization
Diffstat (limited to 'tests/unit/test_plugins.py')
-rw-r--r--tests/unit/test_plugins.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py
index 245a7566b..5bad4e5c4 100644
--- a/tests/unit/test_plugins.py
+++ b/tests/unit/test_plugins.py
@@ -10,6 +10,12 @@ def get_search_mock(query, **kwargs):
result_container=Mock(answers=dict()))
+class PluginMock():
+ default_on = False
+ name = 'Default plugin'
+ description = 'Default plugin description'
+
+
class PluginStoreTest(SearxTestCase):
def test_PluginStore_init(self):
@@ -18,14 +24,14 @@ class PluginStoreTest(SearxTestCase):
def test_PluginStore_register(self):
store = plugins.PluginStore()
- testplugin = plugins.Plugin()
+ testplugin = PluginMock()
store.register(testplugin)
self.assertTrue(len(store.plugins) == 1)
def test_PluginStore_call(self):
store = plugins.PluginStore()
- testplugin = plugins.Plugin()
+ testplugin = PluginMock()
store.register(testplugin)
setattr(testplugin, 'asdf', Mock())
request = Mock()
@@ -40,8 +46,9 @@ class PluginStoreTest(SearxTestCase):
class SelfIPTest(SearxTestCase):
def test_PluginStore_init(self):
+ plugin = plugins.load_and_initialize_plugin('searx.plugins.self_info', False, (None, {}))
store = plugins.PluginStore()
- store.register(plugins.self_info)
+ store.register(plugin)
self.assertTrue(len(store.plugins) == 1)
@@ -89,7 +96,8 @@ class HashPluginTest(SearxTestCase):
def test_PluginStore_init(self):
store = plugins.PluginStore()
- store.register(plugins.hash_plugin)
+ plugin = plugins.load_and_initialize_plugin('searx.plugins.hash_plugin', False, (None, {}))
+ store.register(plugin)
self.assertTrue(len(store.plugins) == 1)