def test_recent_helpful_votes(self):
        # Create a document and verify it doesn't show up in a
        # query for recent_helpful_votes__gt=0.
        r = RevisionFactory(is_approved=True)
        self.refresh()
        eq_(DocumentMappingType.search().filter(
            document_recent_helpful_votes__gt=0).count(), 0)

        # Add an unhelpful vote, it still shouldn't show up.
        HelpfulVoteFactory(revision=r, helpful=False)
        r.document.save()  # Votes don't trigger a reindex.
        self.refresh()
        eq_(DocumentMappingType.search().filter(
            document_recent_helpful_votes__gt=0).count(), 0)

        # Add an helpful vote created 31 days ago, it still shouldn't show up.
        created = datetime.now() - timedelta(days=31)
        HelpfulVoteFactory(revision=r, helpful=True, created=created)
        r.document.save()  # Votes don't trigger a reindex.
        self.refresh()
        eq_(DocumentMappingType.search().filter(
            document_recent_helpful_votes__gt=0).count(), 0)

        # Add an helpful vote created 29 days ago, it should show up now.
        created = datetime.now() - timedelta(days=29)
        HelpfulVoteFactory(revision=r, helpful=True, created=created)
        r.document.save()  # Votes don't trigger a reindex.
        self.refresh()
        eq_(DocumentMappingType.search().filter(
            document_recent_helpful_votes__gt=0).count(), 1)
Pass a callback function that will be called when Basic.Cancel
dataset/ETHPy150Open mozilla/kitsune/kitsune/wiki/tests/test_es.py/DocumentUpdateTests.test_recent_helpful_votes--crossover with--dataset/ETHPy150Open pika/pika/pika/adapters/blocking_connection.py/BlockingChannel.add_on_cancel_callback