Skip to content

Commit 359c288

Browse files
committed
Test localized-attributes settings
1 parent 5a33fab commit 359c288

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
NEW_LOCALIZED_ATTRIBUTES = [{"attributePatterns": ["title"], "locales": ["eng"]}]
2+
3+
4+
def test_get_localized_attributes(empty_index):
5+
"""Tests getting default localized_attributes."""
6+
response = empty_index().get_localized_attributes()
7+
assert response is None
8+
9+
10+
def test_update_localized_attributes(empty_index):
11+
"""Tests updating proximity precision."""
12+
index = empty_index()
13+
response = index.update_localized_attributes(NEW_LOCALIZED_ATTRIBUTES)
14+
update = index.wait_for_task(response.task_uid)
15+
assert update.status == "succeeded"
16+
response = index.get_localized_attributes()
17+
assert NEW_LOCALIZED_ATTRIBUTES == response
18+
19+
20+
def test_reset_localized_attributes(empty_index):
21+
"""Tests resetting the proximity precision to its default value."""
22+
index = empty_index()
23+
# Update the settings first
24+
response = index.update_localized_attributes(NEW_LOCALIZED_ATTRIBUTES)
25+
update = index.wait_for_task(response.task_uid)
26+
assert update.status == "succeeded"
27+
# Check the settings have been correctly updated
28+
response = index.get_localized_attributes()
29+
assert NEW_LOCALIZED_ATTRIBUTES == response
30+
# Check the reset of the settings
31+
response = index.reset_localized_attributes()
32+
update = index.wait_for_task(response.task_uid)
33+
assert update.status == "succeeded"
34+
response = index.get_localized_attributes()
35+
assert response is None

0 commit comments

Comments
 (0)