def test_percolator(app, request):
    """Test percolator."""
    def teardown():
        with app.app_context():
            current_collections.unregister_signals()
            list(current_search.delete())

    request.addfinalizer(teardown)

    with app.test_request_context():
        app.config.update(
            COLLECTIONS_USE_PERCOLATOR=True,
            SEARCH_ELASTIC_KEYWORD_MAPPING={None: ['_all']},
        )

        search = InvenioSearch(app)
        search.register_mappings('records', 'data')

        InvenioIndexer(app)

        current_collections.unregister_signals()
        current_collections.register_signals()

        list(current_search.create())

        _try_populate_collections()
def test_without_percolator(app, request):
    """Test percolator."""
    with app.test_request_context():
        app.config.update(
            COLLECTIONS_USE_PERCOLATOR=False,
        )

        current_collections.unregister_signals()
        current_collections.register_signals()

        _try_populate_collections()