diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2019-12-24 13:33:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-24 13:33:07 +0100 |
commit | fb668e2075484084a1f7a9b205ecbe7957ea5e8e (patch) | |
tree | c6f2e83d9d222d69d79348faac342c07c32dbbf3 /tests/unit/engines/test_duden.py | |
parent | f407dd8ef4e3f6c82bef31f678139d6db2a4d810 (diff) | |
parent | 6d232e9b695c2553b7594efe00c4f63aa96fc62d (diff) | |
download | searxng-fb668e2075484084a1f7a9b205ecbe7957ea5e8e.tar.gz searxng-fb668e2075484084a1f7a9b205ecbe7957ea5e8e.zip |
Merge branch 'master' into libgen
Diffstat (limited to 'tests/unit/engines/test_duden.py')
-rw-r--r-- | tests/unit/engines/test_duden.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/tests/unit/engines/test_duden.py b/tests/unit/engines/test_duden.py deleted file mode 100644 index 52fc513d0..000000000 --- a/tests/unit/engines/test_duden.py +++ /dev/null @@ -1,47 +0,0 @@ -from collections import defaultdict -import mock -from searx.engines import duden -from searx.testing import SearxTestCase -from datetime import datetime - - -class TestDudenEngine(SearxTestCase): - - def test_request(self): - query = 'Haus' - dic = defaultdict(dict) - data = [ - [1, 'https://www.duden.de/suchen/dudenonline/Haus'], - [2, 'https://www.duden.de/suchen/dudenonline/Haus?search_api_fulltext=&page=1'] - ] - for page_no, exp_res in data: - dic['pageno'] = page_no - params = duden.request(query, dic) - self.assertTrue('url' in params) - self.assertTrue(query in params['url']) - self.assertTrue('duden.de' in params['url']) - self.assertEqual(params['url'], exp_res) - - def test_response(self): - resp = mock.Mock(text='<html></html>') - self.assertEqual(duden.response(resp), []) - - html = """ - <section class="vignette"> - <h2"> <a href="/rechtschreibung/Haus"> - <strong>This is the title also here</strong> - </a> </h2> - <p>This is the content</p> - </section> - """ - resp = mock.Mock(text=html) - results = duden.response(resp) - - self.assertEqual(len(results), 1) - self.assertEqual(type(results), list) - - # testing result (dictionary entry) - r = results[0] - self.assertEqual(r['url'], 'https://www.duden.de/rechtschreibung/Haus') - self.assertEqual(r['title'], 'This is the title also here') - self.assertEqual(r['content'], 'This is the content') |