示例#1
0
    def test_request(self):
        query = u'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 0
        dicto['language'] = 'fr_FR'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('language%3AFR' in params['url'])
        self.assertTrue('bing.com' in params['url'])

        dicto['language'] = 'all'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('language' in params['url'])
示例#2
0
    def test_request(self):
        query = 'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 0
        dicto['language'] = 'fr_FR'
        params = bing.request(query, dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('language%3AFR' in params['url'])
        self.assertTrue('bing.com' in params['url'])

        dicto['language'] = 'all'
        params = bing.request(query, dicto)
        self.assertTrue('language' not in params['url'])
示例#3
0
    def test_request(self):
        bing.supported_languages = ['en', 'fr', 'zh-CHS', 'zh-CHT', 'pt-PT', 'pt-BR']
        query = u'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 0
        dicto['language'] = 'fr-FR'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('language%3AFR' in params['url'])
        self.assertTrue('bing.com' in params['url'])

        dicto['language'] = 'all'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('language' in params['url'])
示例#4
0
    def test_request(self):
        query = 'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 0
        dicto['language'] = 'fr_FR'
        params = bing.request(query, dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('bing.com' in params['url'])
        self.assertTrue('SRCHHPGUSR' in params['cookies'])
        self.assertTrue('fr' in params['cookies']['SRCHHPGUSR'])

        dicto['language'] = 'all'
        params = bing.request(query, dicto)
        self.assertTrue('SRCHHPGUSR' in params['cookies'])
        self.assertTrue('en' in params['cookies']['SRCHHPGUSR'])
示例#5
0
    def test_request(self):
        query = 'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 0
        dicto['language'] = 'fr_FR'
        params = bing.request(query, dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('bing.com' in params['url'])
        self.assertTrue('SRCHHPGUSR' in params['cookies'])
        self.assertTrue('fr' in params['cookies']['SRCHHPGUSR'])

        dicto['language'] = 'all'
        params = bing.request(query, dicto)
        self.assertTrue('SRCHHPGUSR' in params['cookies'])
        self.assertTrue('en' in params['cookies']['SRCHHPGUSR'])
示例#6
0
    def test_request(self):
        query = "test_query"
        dicto = defaultdict(dict)
        dicto["pageno"] = 0
        dicto["language"] = "fr_FR"
        params = bing.request(query, dicto)
        self.assertTrue("url" in params)
        self.assertTrue(query in params["url"])
        self.assertTrue("bing.com" in params["url"])
        self.assertTrue("SRCHHPGUSR" in params["cookies"])
        self.assertTrue("fr" in params["cookies"]["SRCHHPGUSR"])

        dicto["language"] = "all"
        params = bing.request(query, dicto)
        self.assertTrue("SRCHHPGUSR" in params["cookies"])
        self.assertTrue("en" in params["cookies"]["SRCHHPGUSR"])
示例#7
0
    def test_request(self):
        bing.supported_languages = [
            'en', 'fr', 'zh-CHS', 'zh-CHT', 'pt-PT', 'pt-BR'
        ]
        query = u'test_query'
        dicto = defaultdict(dict)
        dicto['pageno'] = 1
        dicto['language'] = 'fr-FR'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('language%3AFR' in params['url'])
        self.assertTrue('bing.com' in params['url'])

        dicto['language'] = 'all'
        params = bing.request(query.encode('utf-8'), dicto)
        self.assertTrue('language' in params['url'])
示例#8
0
文件: test_bing.py 项目: MrLpk/searx
 def test_request(self):
     query = u'test_query'
     dicto = defaultdict(dict)
     dicto['pageno'] = 0
     dicto['language'] = 'fr-FR'
     params = bing.request(query.encode('utf-8'), dicto)
     self.assertTrue('url' in params)
     self.assertTrue(query in params['url'])
     self.assertTrue('language%3AFR' in params['url'])
     self.assertTrue('bing.com' in params['url'])