|
@@ -14,23 +14,19 @@ class TestCurrencyConvertEngine(SearxTestCase):
|
14
|
14
|
params = currency_convert.request(query, dicto)
|
15
|
15
|
self.assertNotIn('url', params)
|
16
|
16
|
|
17
|
|
- query = '1.1.1 EUR in USD'
|
18
|
|
- params = currency_convert.request(query, dicto)
|
19
|
|
- self.assertNotIn('url', params)
|
20
|
|
-
|
21
|
|
- query = '10 eur in usd'
|
|
17
|
+ query = 'convert 10 Pound Sterlings to United States Dollars'
|
22
|
18
|
params = currency_convert.request(query, dicto)
|
23
|
19
|
self.assertIn('url', params)
|
24
|
20
|
self.assertIn('finance.yahoo.com', params['url'])
|
25
|
|
- self.assertIn('EUR', params['url'])
|
|
21
|
+ self.assertIn('GBP', params['url'])
|
26
|
22
|
self.assertIn('USD', params['url'])
|
27
|
23
|
|
28
|
24
|
def test_response(self):
|
29
|
25
|
dicto = defaultdict(dict)
|
30
|
26
|
dicto['ammount'] = float(10)
|
31
|
|
- dicto['from'] = "EUR"
|
|
27
|
+ dicto['from'] = "GBP"
|
32
|
28
|
dicto['to'] = "USD"
|
33
|
|
- dicto['from_name'] = "euro"
|
|
29
|
+ dicto['from_name'] = "pound sterling"
|
34
|
30
|
dicto['to_name'] = "United States dollar"
|
35
|
31
|
response = mock.Mock(text='a,b,c,d', search_params=dicto)
|
36
|
32
|
self.assertEqual(currency_convert.response(response), [])
|
|
@@ -40,7 +36,8 @@ class TestCurrencyConvertEngine(SearxTestCase):
|
40
|
36
|
results = currency_convert.response(response)
|
41
|
37
|
self.assertEqual(type(results), list)
|
42
|
38
|
self.assertEqual(len(results), 1)
|
43
|
|
- self.assertEqual(results[0]['answer'], '10.0 EUR = 5.0 USD, 1 EUR (euro) = 0.5 USD (United States dollar)')
|
|
39
|
+ self.assertEqual(results[0]['answer'], '10.0 GBP = 5.0 USD, 1 GBP (pound sterling)' +
|
|
40
|
+ ' = 0.5 USD (United States dollar)')
|
44
|
41
|
now_date = datetime.now().strftime('%Y%m%d')
|
45
|
42
|
self.assertEqual(results[0]['url'], 'https://finance.yahoo.com/currency/converter-results/' +
|
46
|
|
- now_date + '/10.0-eur-to-usd.html')
|
|
43
|
+ now_date + '/10.0-gbp-to-usd.html')
|