def mock_elasticsearch(): """Mock ElasticSearch in tests by default. Tests that do need ES should inherit from ESTestCase, which will stop the mock at setup time.""" start_es_mocks() yield stop_es_mocks()
def mock_elasticsearch(): """Mock ElasticSearch in tests by default. Tests that do need ES should inherit from ESTestCase, which will stop the mock at setup time.""" start_es_mocks() yield stop_es_mocks()
def es_test(pytestconfig): from olympia.amo.tests import (start_es_mocks, stop_es_mocks, amo_search, setup_es_test_data) stop_es_mocks() es = amo_search.get_es(timeout=settings.ES_TIMEOUT) _SEARCH_ANALYZER_MAP = amo.SEARCH_ANALYZER_MAP amo.SEARCH_ANALYZER_MAP = { 'english': ['en-us'], 'spanish': ['es'], } setup_es_test_data(es) yield amo.SEARCH_ANALYZER_MAP = _SEARCH_ANALYZER_MAP start_es_mocks()
def es_test(pytestconfig): from olympia.amo.tests import ( start_es_mocks, stop_es_mocks, amo_search, setup_es_test_data) stop_es_mocks() es = amo_search.get_es(timeout=settings.ES_TIMEOUT) _SEARCH_ANALYZER_MAP = amo.SEARCH_ANALYZER_MAP amo.SEARCH_ANALYZER_MAP = { 'english': ['en-us'], 'spanish': ['es'], } setup_es_test_data(es) yield amo.SEARCH_ANALYZER_MAP = _SEARCH_ANALYZER_MAP start_es_mocks()