Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Test multiple words search
Jakub Draganekf5dcc8eb371a
diff --git a/tests/cassettes/test_search_multiple_words.yaml b/tests/cassettes/test_search_multiple_words.yamlnew file mode 100644index 0000000000..7e2b90f2b8--- /dev/null+++ b/tests/cassettes/test_search_multiple_words.yaml@@ -0,0 +1,19 @@+interactions:+- request:+ body: '{"query": {"bool": {"filter": [{"match": {"content_type": "product.Product"}},+ {"bool": {"must": [{"bool": {"should": [{"range": {"available_on_filter": {"lte":+ "2017-10-17"}}}, {"bool": {"must_not": {"term": {"field": "available_on_filter"}}}}]}},+ {"term": {"is_published_filter": true}}]}}], "must": {"multi_match": {"query":+ "how fortunate the man with none", "fields": ["_all", "_partials"]}}}}}'+ headers:+ connection: [keep-alive]+ content-type: [application/json]+ method: GET+ uri: http://search:9200/storefront__product_product/_search?from=0&_source=pk+ response:+ body: {string: '{"took":9,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}+ headers:+ content-length: ['122']+ content-type: [application/json; charset=UTF-8]+ status: {code: 200, message: OK}+version: 1diff --git a/tests/test_search.py b/tests/test_search.pyindex 499289f495..3475105282 100644--- a/tests/test_search.py+++ b/tests/test_search.py@@ -25,6 +25,14 @@ def test_search_with_empty_result(db, client):assert WORD == response.context['query'][email protected](record_mode='once', match_on=MATCH_SEARCH_REQUEST)+def test_search_multiple_words(db, client):+ ''' Check request format for multiple word phrases '''+ PHRASE = 'how fortunate the man with none'+ client.get(reverse('search:search'), {'q': PHRASE})++@pytest.fixturedef indexed_products(product_class, default_category):''' Products to be found by search backend