예제 #1
0
파일: test_api.py 프로젝트: vprime/Misago
    def test_empty_(self):
        """api handles empty search query"""
        response = self.client.get('%s?q=' % self.test_link)
        self.assertEqual(response.status_code, 200)

        providers = searchproviders.get_providers(True)
        for i, provider in enumerate(response.json()):
            provider_api = reverse('misago:api:search', kwargs={
                'search_provider': providers[i].url
            })
            self.assertEqual(provider_api, provider['api'])

            self.assertEqual(six.text_type(providers[i].name), provider['name'])
            self.assertEqual(provider['results']['results'], [])
            self.assertEqual(int(provider['time']), 0)
예제 #2
0
    def test_empty_search(self):
        """api handles empty search query"""
        response = self.client.get('%s?q=' % self.test_link)
        self.assertEqual(response.status_code, 200)

        providers = searchproviders.get_providers(True)
        for i, provider in enumerate(response.json()):
            provider_api = reverse(
                'misago:api:search',
                kwargs={'search_provider': providers[i].url},
            )
            self.assertEqual(provider_api, provider['api'])

            self.assertEqual(six.text_type(providers[i].name), provider['name'])
            self.assertEqual(provider['results']['results'], [])
            self.assertEqual(int(provider['time']), 0)