Skip to content

Commit 71a022e

Browse files
authored
Merge pull request #289 from meilisearch/fix-tests
Adapts tests according to v0.21.0 breaking changes
2 parents 96b8f2d + 124effd commit 71a022e

File tree

5 files changed

+8
-58
lines changed

5 files changed

+8
-58
lines changed

meilisearch/tests/client/test_client_version_meilisearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ def test_get_version(client):
44
response = client.get_version()
55
assert 'pkgVersion' in response
66
assert 'commitSha' in response
7-
assert 'buildDate' in response
7+
assert 'commitDate' in response

meilisearch/tests/index/test_index_search_meilisearch.py

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_custom_search_params_with_string_list(index_with_documents):
111111
assert 'overview' in response['hits'][0]
112112
assert not 'release_date' in response['hits'][0]
113113
assert 'title' in response['hits'][0]['_formatted']
114-
assert not 'overview' in response['hits'][0]['_formatted']
114+
assert 'overview' in response['hits'][0]['_formatted']
115115

116116
def test_custom_search_params_with_facets_distribution(index_with_documents):
117117
index = index_with_documents()
@@ -127,59 +127,8 @@ def test_custom_search_params_with_facets_distribution(index_with_documents):
127127
assert len(response['hits']) == 12
128128
assert 'facetsDistribution' in response
129129
assert 'exhaustiveFacetsCount' in response
130-
assert response['exhaustiveFacetsCount']
130+
assert not response['exhaustiveFacetsCount']
131131
assert 'genre' in response['facetsDistribution']
132132
assert response['facetsDistribution']['genre']['cartoon'] == 1
133133
assert response['facetsDistribution']['genre']['action'] == 3
134134
assert response['facetsDistribution']['genre']['fantasy'] == 1
135-
136-
def test_custom_search_params_with_facet_filters(index_with_documents):
137-
index = index_with_documents()
138-
update = index.update_attributes_for_faceting(['genre'])
139-
index.wait_for_pending_update(update['updateId'])
140-
response = index.search(
141-
'world',
142-
{
143-
'facetFilters': [['genre:action']]
144-
}
145-
)
146-
assert isinstance(response, dict)
147-
assert len(response['hits']) == 3
148-
assert 'facetsDistribution' not in response
149-
assert 'exhaustiveFacetsCount' not in response
150-
151-
def test_custom_search_params_with_multiple_facet_filters(index_with_documents):
152-
index = index_with_documents()
153-
update = index.update_attributes_for_faceting(['genre'])
154-
index.wait_for_pending_update(update['updateId'])
155-
response = index.search(
156-
'world',
157-
{
158-
'facetFilters': ['genre:action', ['genre:action', 'genre:action']]
159-
}
160-
)
161-
assert isinstance(response, dict)
162-
assert len(response['hits']) == 3
163-
assert 'facetsDistribution' not in response
164-
assert 'exhaustiveFacetsCount' not in response
165-
166-
def test_custom_search_params_with_many_params(index_with_documents):
167-
index = index_with_documents()
168-
update = index.update_attributes_for_faceting(['genre'])
169-
index.wait_for_pending_update(update['updateId'])
170-
response = index.search(
171-
'world',
172-
{
173-
'facetFilters': [['genre:action']],
174-
'attributesToRetrieve': ['title', 'poster']
175-
}
176-
)
177-
assert isinstance(response, dict)
178-
assert len(response['hits']) == 3
179-
assert 'facetsDistribution' not in response
180-
assert 'exhaustiveFacetsCount' not in response
181-
assert 'title' in response['hits'][0]
182-
assert 'poster' in response['hits'][0]
183-
assert 'overview' not in response['hits'][0]
184-
assert 'release_date' not in response['hits'][0]
185-
assert response['hits'][0]['title'] == 'Avengers: Infinity War'

meilisearch/tests/index/test_index_wait_for_pending_update.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_wait_for_pending_update_default(index_with_documents):
1313
assert isinstance(update, dict)
1414
assert 'status' in update
1515
assert update['status'] != 'enqueued'
16+
assert update['status'] != 'processing'
1617

1718
def test_wait_for_pending_update_timeout(index_with_documents):
1819
"""Tests timeout risen by waiting for an update."""
@@ -34,6 +35,7 @@ def test_wait_for_pending_update_interval_custom(index_with_documents, small_mov
3435
assert isinstance(wait_update, dict)
3536
assert 'status' in wait_update
3637
assert wait_update['status'] != 'enqueued'
38+
assert wait_update['status'] != 'processing'
3739
assert time_delta.seconds >= 1
3840

3941
def test_wait_for_pending_update_interval_zero(index_with_documents, small_movies):
@@ -49,3 +51,4 @@ def test_wait_for_pending_update_interval_zero(index_with_documents, small_movie
4951
assert isinstance(wait_update, dict)
5052
assert 'status' in wait_update
5153
assert wait_update['status'] != 'enqueued'
54+
assert wait_update['status'] != 'processing'

meilisearch/tests/settings/test_settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
}
66

77
DEFAULT_RANKING_RULES = [
8-
'typo',
98
'words',
9+
'typo',
1010
'proximity',
1111
'attribute',
12-
'wordsPosition',
1312
'exactness'
1413
]
1514

meilisearch/tests/settings/test_settings_ranking_rules_meilisearch.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11

22
NEW_RANKING_RULES = ['typo', 'exactness']
33
DEFAULT_RANKING_RULES = [
4-
'typo',
54
'words',
5+
'typo',
66
'proximity',
77
'attribute',
8-
'wordsPosition',
98
'exactness'
109
]
1110

0 commit comments

Comments
 (0)