|
1 | 1 | # pylint: disable=invalid-name
|
2 | 2 |
|
3 |
| -ATTRIBUTES_FOR_FACETING = ['title', 'release_date'] |
| 3 | +FILTERABLE_ATTRIBUTES = ['title', 'release_date'] |
4 | 4 |
|
5 |
| -def test_get_attributes_for_faceting(empty_index): |
| 5 | +def test_get_filterable_attributes(empty_index): |
6 | 6 | """Tests getting the attributes for faceting."""
|
7 |
| - response = empty_index().get_attributes_for_faceting() |
| 7 | + response = empty_index().get_filterable_attributes() |
8 | 8 | assert isinstance(response, list)
|
9 | 9 | assert response == []
|
10 | 10 |
|
11 |
| -def test_update_attributes_for_faceting(empty_index): |
| 11 | +def test_update_filterable_attributes(empty_index): |
12 | 12 | """Tests updating the attributes for faceting."""
|
13 | 13 | index = empty_index()
|
14 |
| - response = index.update_attributes_for_faceting(ATTRIBUTES_FOR_FACETING) |
| 14 | + response = index.update_filterable_attributes(FILTERABLE_ATTRIBUTES) |
15 | 15 | index.wait_for_pending_update(response['updateId'])
|
16 |
| - get_attributes_new = index.get_attributes_for_faceting() |
17 |
| - assert len(get_attributes_new) == len(ATTRIBUTES_FOR_FACETING) |
18 |
| - get_attributes = index.get_attributes_for_faceting() |
19 |
| - for attribute in ATTRIBUTES_FOR_FACETING: |
| 16 | + get_attributes_new = index.get_filterable_attributes() |
| 17 | + assert len(get_attributes_new) == len(FILTERABLE_ATTRIBUTES) |
| 18 | + get_attributes = index.get_filterable_attributes() |
| 19 | + for attribute in FILTERABLE_ATTRIBUTES: |
20 | 20 | assert attribute in get_attributes
|
21 | 21 |
|
22 |
| -def test_update_attributes_for_faceting_to_none(empty_index): |
| 22 | +def test_update_filterable_attributes_to_none(empty_index): |
23 | 23 | """Tests updating the attributes for faceting at null."""
|
24 | 24 | index = empty_index()
|
25 | 25 | # Update the settings first
|
26 |
| - response = index.update_attributes_for_faceting(ATTRIBUTES_FOR_FACETING) |
| 26 | + response = index.update_filterable_attributes(FILTERABLE_ATTRIBUTES) |
27 | 27 | update = index.wait_for_pending_update(response['updateId'])
|
28 | 28 | assert update['status'] == 'processed'
|
29 | 29 | # Check the settings have been correctly updated
|
30 |
| - get_attributes = index.get_attributes_for_faceting() |
31 |
| - for attribute in ATTRIBUTES_FOR_FACETING: |
| 30 | + get_attributes = index.get_filterable_attributes() |
| 31 | + for attribute in FILTERABLE_ATTRIBUTES: |
32 | 32 | assert attribute in get_attributes
|
33 | 33 | # Launch test to update at null the setting
|
34 |
| - response = index.update_attributes_for_faceting(None) |
| 34 | + response = index.update_filterable_attributes(None) |
35 | 35 | index.wait_for_pending_update(response['updateId'])
|
36 |
| - response = index.get_attributes_for_faceting() |
| 36 | + response = index.get_filterable_attributes() |
37 | 37 | assert response == []
|
38 | 38 |
|
39 |
| -def test_reset_attributes_for_faceting(empty_index): |
| 39 | +def test_reset_filterable_attributes(empty_index): |
40 | 40 | """Tests resetting the attributes for faceting setting to its default value"""
|
41 | 41 | index = empty_index()
|
42 | 42 | # Update the settings first
|
43 |
| - response = index.update_attributes_for_faceting(ATTRIBUTES_FOR_FACETING) |
| 43 | + response = index.update_filterable_attributes(FILTERABLE_ATTRIBUTES) |
44 | 44 | update = index.wait_for_pending_update(response['updateId'])
|
45 | 45 | assert update['status'] == 'processed'
|
46 | 46 | # Check the settings have been correctly updated
|
47 |
| - get_attributes_new = index.get_attributes_for_faceting() |
48 |
| - assert len(get_attributes_new) == len(ATTRIBUTES_FOR_FACETING) |
49 |
| - get_attributes = index.get_attributes_for_faceting() |
50 |
| - for attribute in ATTRIBUTES_FOR_FACETING: |
| 47 | + get_attributes_new = index.get_filterable_attributes() |
| 48 | + assert len(get_attributes_new) == len(FILTERABLE_ATTRIBUTES) |
| 49 | + get_attributes = index.get_filterable_attributes() |
| 50 | + for attribute in FILTERABLE_ATTRIBUTES: |
51 | 51 | assert attribute in get_attributes
|
52 | 52 | # Check the reset of the settings
|
53 |
| - response = index.reset_attributes_for_faceting() |
| 53 | + response = index.reset_filterable_attributes() |
54 | 54 | assert isinstance(response, dict)
|
55 | 55 | assert 'updateId' in response
|
56 | 56 | index.wait_for_pending_update(response['updateId'])
|
57 |
| - response = index.get_attributes_for_faceting() |
| 57 | + response = index.get_filterable_attributes() |
58 | 58 | assert isinstance(response, list)
|
59 | 59 | assert response == []
|
0 commit comments