diff options
author | Alexandre Flament <alex@al-f.net> | 2017-01-02 12:06:04 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2017-01-02 12:06:04 +0100 |
commit | 84a2c97a653d216690da0000f47582118709d2d7 (patch) | |
tree | c735600400102ff5d96477aaaf1809dfd987be01 /tests | |
parent | 3d8c9bab9618b4d0cceadfac888af4560f7d3c9b (diff) | |
download | searxng-84a2c97a653d216690da0000f47582118709d2d7.tar.gz searxng-84a2c97a653d216690da0000f47582118709d2d7.zip |
[mod] searx uses flask framework only in webapp.py. Make migration to another framework easier.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_plugins.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py index c9e65dfcb..78dcea478 100644 --- a/tests/unit/test_plugins.py +++ b/tests/unit/test_plugins.py @@ -28,14 +28,12 @@ class PluginStoreTest(SearxTestCase): testplugin = plugins.Plugin() store.register(testplugin) setattr(testplugin, 'asdf', Mock()) - request = Mock(user_plugins=[]) - store.call('asdf', request, Mock()) + request = Mock() + store.call([], 'asdf', request, Mock()) self.assertFalse(testplugin.asdf.called) - request.user_plugins.append(testplugin) - store.call('asdf', request, Mock()) - + store.call([testplugin], 'asdf', request, Mock()) self.assertTrue(testplugin.asdf.called) @@ -48,42 +46,40 @@ class SelfIPTest(SearxTestCase): self.assertTrue(len(store.plugins) == 1) # IP test - request = Mock(user_plugins=store.plugins, - remote_addr='127.0.0.1') + request = Mock(remote_addr='127.0.0.1') request.headers.getlist.return_value = [] search = get_search_mock(query='ip', pageno=1) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertTrue('127.0.0.1' in search.result_container.answers) search = get_search_mock(query='ip', pageno=2) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertFalse('127.0.0.1' in search.result_container.answers) # User agent test - request = Mock(user_plugins=store.plugins, - user_agent='Mock') + request = Mock(user_agent='Mock') request.headers.getlist.return_value = [] search = get_search_mock(query='user-agent', pageno=1) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertTrue('Mock' in search.result_container.answers) search = get_search_mock(query='user-agent', pageno=2) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertFalse('Mock' in search.result_container.answers) search = get_search_mock(query='user-agent', pageno=1) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertTrue('Mock' in search.result_container.answers) search = get_search_mock(query='user-agent', pageno=2) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertFalse('Mock' in search.result_container.answers) search = get_search_mock(query='What is my User-Agent?', pageno=1) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertTrue('Mock' in search.result_container.answers) search = get_search_mock(query='What is my User-Agent?', pageno=2) - store.call('post_search', request, search) + store.call(store.plugins, 'post_search', request, search) self.assertFalse('Mock' in search.result_container.answers) |