Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Overwrite default ES connection in tests to decouple from real setup

Jakub Draganekbdb7b19a4abf
diff --git a/tests/test_search.py b/tests/test_search.py
index f70b13095a..0402167455 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -1,9 +1,9 @@
from saleor.product.models import Product
from django.core.urlresolvers import reverse
+from elasticsearch_dsl.connections import connections
from decimal import Decimal
import pytest
-
MATCH_SEARCH_REQUEST = ['method', 'host', 'port', 'path', 'body']
PRODUCTS_INDEXED = {15, 56} # same as in recorded data!
PRODUCTS_TO_UNPUBLISH = {56} # choose from PRODUCTS_INDEXED
@@ -18,6 +18,12 @@ def es_autosync_disabled(settings):
settings.ELASTICSEARCH_DSL_AUTOSYNC = False
[email protected](scope='module', autouse=True)
+def enable_es():
+ ES_URL = 'http://search:9200'
+ connections.create_connection('default', hosts=[ES_URL])
+
+
@pytest.mark.vcr()
@pytest.fixture
def indexed_products(product_class, default_category):