Explorar el Código

update unit tests for google news and wikidata

Marc Abonce Seguin hace 6 años
padre
commit
9687786226
Se han modificado 2 ficheros con 3 adiciones y 7 borrados
  1. 2
    2
      tests/unit/engines/test_google_news.py
  2. 1
    5
      tests/unit/engines/test_wikidata.py

+ 2
- 2
tests/unit/engines/test_google_news.py Ver fichero

@@ -42,7 +42,7 @@ class TestGoogleNewsEngine(SearxTestCase):
42 42
                 <div class="ts _JGs _JHs _tJs _KGs _jHs">
43 43
                     <div class="_hJs">
44 44
                         <h3 class="r _gJs">
45
-                            <a class="l _PMs" href="https://example.com/" onmousedown="return rwt(this,'','','','11','AFQjCNEyehpzD5cJK1KUfXBx9RmsbqqG9g','','0ahUKEwjB58OR54HWAhWnKJoKHSQhAMY4ChCpAggiKAAwAA','','',event)">Example title</a>
45
+                            <a class="l lLrAF" href="https://example.com/" onmousedown="return rwt(this,'','','','11','AFQjCNEyehpzD5cJK1KUfXBx9RmsbqqG9g','','0ahUKEwjB58OR54HWAhWnKJoKHSQhAMY4ChCpAggiKAAwAA','','',event)">Example title</a>
46 46
                         </h3>
47 47
                         <div class="slp">
48 48
                             <span class="_OHs _PHs">
@@ -63,7 +63,7 @@ class TestGoogleNewsEngine(SearxTestCase):
63 63
                     </a>
64 64
                     <div class="_hJs">
65 65
                         <h3 class="r _gJs">
66
-                            <a class="l _PMs" href="https://example2.com/" onmousedown="return rwt(this,'','','','12','AFQjCNHObfH7sYmLWI1SC-YhWXKZFRzRjw','','0ahUKEwjB58OR54HWAhWnKJoKHSQhAMY4ChCpAgglKAAwAQ','','',event)">Example title 2</a>
66
+                            <a class="l lLrAF" href="https://example2.com/" onmousedown="return rwt(this,'','','','12','AFQjCNHObfH7sYmLWI1SC-YhWXKZFRzRjw','','0ahUKEwjB58OR54HWAhWnKJoKHSQhAMY4ChCpAgglKAAwAQ','','',event)">Example title 2</a>
67 67
                         </h3>
68 68
                         <div class="slp">
69 69
                             <span class="_OHs _PHs">

+ 1
- 5
tests/unit/engines/test_wikidata.py Ver fichero

@@ -9,20 +9,15 @@ from searx.testing import SearxTestCase
9 9
 class TestWikidataEngine(SearxTestCase):
10 10
 
11 11
     def test_request(self):
12
-        wikidata.supported_languages = ['en', 'es']
13 12
         query = 'test_query'
14 13
         dicto = defaultdict(dict)
15
-        dicto['language'] = 'en-US'
16 14
         params = wikidata.request(query, dicto)
17 15
         self.assertIn('url', params)
18 16
         self.assertIn(query, params['url'])
19 17
         self.assertIn('wikidata.org', params['url'])
20
-        self.assertIn('en', params['url'])
21 18
 
22
-        dicto['language'] = 'es-ES'
23 19
         params = wikidata.request(query, dicto)
24 20
         self.assertIn(query, params['url'])
25
-        self.assertIn('es', params['url'])
26 21
 
27 22
     # successful cases are not tested here to avoid sending additional requests
28 23
     def test_response(self):
@@ -31,6 +26,7 @@ class TestWikidataEngine(SearxTestCase):
31 26
         self.assertRaises(AttributeError, wikidata.response, '')
32 27
         self.assertRaises(AttributeError, wikidata.response, '[]')
33 28
 
29
+        wikidata.supported_languages = ['en', 'es']
34 30
         response = mock.Mock(text='<html></html>', search_params={"language": "en"})
35 31
         self.assertEqual(wikidata.response(response), [])
36 32