'Test the ESPaginator only queries ES one time.'

def test_single_hit(self):

    es = WebappIndexer.get_es()
    orig_search = es.search
    es.counter = 0
    def monkey_search(*args, **kwargs):
        es.counter += 1
        return orig_search(*args, **kwargs)
    es.search = monkey_search
    ESPaginator(WebappIndexer.search(), 5).object_list.execute()
    eq_(es.counter, 1)
    es.search = orig_search
