Пример #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
 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'])