def test_request(self): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 dicto['language'] = 'de-DE' params = swisscows.request(query, dicto) self.assertTrue('url' in params) self.assertTrue(query in params['url']) self.assertTrue('swisscows.ch' in params['url']) self.assertTrue('uiLanguage=de' in params['url']) self.assertTrue('region=de-DE' in params['url']) dicto['category'] = 'images' params = swisscows.request(query, dicto) self.assertIn('image', params['url'])
def test_request(self): swisscows.supported_languages = ['de-AT', 'de-DE'] swisscows.language_aliases = {} query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 dicto['language'] = 'de-DE' params = swisscows.request(query, dicto) self.assertTrue('url' in params) self.assertTrue(query in params['url']) self.assertTrue('swisscows.ch' in params['url']) self.assertTrue('uiLanguage=de' in params['url']) self.assertTrue('region=de-DE' in params['url']) dicto['language'] = 'all' params = swisscows.request(query, dicto) self.assertTrue('uiLanguage=browser' in params['url']) self.assertTrue('region=browser' in params['url']) dicto['category'] = 'images' params = swisscows.request(query, dicto) self.assertIn('image', params['url'])