def test_site_search(self, m, process_site_results): m.register_uri('GET', search_url, status_code=200, json={}) search_site('help', limit=10, offset=0) history = m.request_history[0] self.assertEqual(history.qs['query'], ['help']) self.assertEqual(history.qs['limit'], ['10']) self.assertEqual(history.qs['offset'], ['0']) self.assertTrue(process_site_results.called)
def test_site_search_failed(self, m, process_site_results): m.register_uri('GET', search_url, status_code=500) search_site('help', limit=10, offset=0) process_site_results.assert_not_called()