summaryrefslogtreecommitdiff
path: root/tests/unit/engines/test_github.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2019-12-24 15:42:05 +0100
committerGitHub <noreply@github.com>2019-12-24 15:42:05 +0100
commit38dad2e8e3b100711afe3ae942aaed5111841cd6 (patch)
tree51f1a35121155010411aa5970ef06aff80adf741 /tests/unit/engines/test_github.py
parent0ae86cd1685d244c83a6080a7816365096ab06f8 (diff)
parenta395fb4a8d030d5b8fde496d2ae722bc034d3e32 (diff)
Merge branch 'master' into ne/fix-infinite_scroll-with-vim_bindings
Diffstat (limited to 'tests/unit/engines/test_github.py')
-rw-r--r--tests/unit/engines/test_github.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/tests/unit/engines/test_github.py b/tests/unit/engines/test_github.py
deleted file mode 100644
index 460be8c3d..000000000
--- a/tests/unit/engines/test_github.py
+++ /dev/null
@@ -1,61 +0,0 @@
-from collections import defaultdict
-import mock
-from searx.engines import github
-from searx.testing import SearxTestCase
-
-
-class TestGitHubEngine(SearxTestCase):
-
- def test_request(self):
- query = 'test_query'
- params = github.request(query, defaultdict(dict))
- self.assertTrue('url' in params)
- self.assertTrue(query in params['url'])
- self.assertTrue('github.com' in params['url'])
- self.assertEqual(params['headers']['Accept'], github.accept_header)
-
- def test_response(self):
- self.assertRaises(AttributeError, github.response, None)
- self.assertRaises(AttributeError, github.response, [])
- self.assertRaises(AttributeError, github.response, '')
- self.assertRaises(AttributeError, github.response, '[]')
-
- response = mock.Mock(text='{}')
- self.assertEqual(github.response(response), [])
-
- response = mock.Mock(text='{"items": []}')
- self.assertEqual(github.response(response), [])
-
- json = """
- {
- "items": [
- {
- "name": "title",
- "html_url": "url",
- "description": ""
- }
- ]
- }
- """
- response = mock.Mock(text=json)
- results = github.response(response)
- self.assertEqual(type(results), list)
- self.assertEqual(len(results), 1)
- self.assertEqual(results[0]['title'], 'title')
- self.assertEqual(results[0]['url'], 'url')
- self.assertEqual(results[0]['content'], '')
-
- json = """
- {
- "items": [
- {
- "name": "title",
- "html_url": "url",
- "description": "desc"
- }
- ]
- }
- """
- response = mock.Mock(text=json)
- results = github.response(response)
- self.assertEqual(results[0]['content'], "desc")