summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
authormarc <a01200356@itesm.mx>2016-12-15 00:34:43 -0600
committermarc <a01200356@itesm.mx>2016-12-15 00:40:21 -0600
commitaf35eee10b98940c51c6e5e18629de514b4bd48d (patch)
tree804b0a4cfe08bb897541e9e8571b921a78e07992 /searx/engines/duckduckgo.py
parente0c270bd72f7b2a40222e3ed264e25d36cb0fc30 (diff)
downloadsearxng-af35eee10b98940c51c6e5e18629de514b4bd48d.tar.gz
searxng-af35eee10b98940c51c6e5e18629de514b4bd48d.zip
tests for _fetch_supported_languages in engines
and refactor method to make it testable without making requests
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r--searx/engines/duckduckgo.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 9cf5fb339..df230222d 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -119,11 +119,10 @@ def response(resp):
# get supported languages from their site
-def fetch_supported_languages():
- response = get(supported_languages_url)
+def _fetch_supported_languages(resp):
# response is a js file with regions as an embedded object
- response_page = response.text
+ response_page = resp.text
response_page = response_page[response_page.find('regions:{') + 8:]
response_page = response_page[:response_page.find('}') + 1]