|
8 | 8 | from tests.utils.version import is_v30_or_above |
9 | 9 | from typesense.client import Client |
10 | 10 | from typesense.curation_set import CurationSet |
| 11 | +from typesense.curation_sets import CurationSets |
11 | 12 | from typesense.types.curation_set import ( |
12 | 13 | CurationItemDeleteSchema, |
13 | 14 | CurationItemSchema, |
@@ -121,3 +122,48 @@ def test_delete_item(fake_curation_set: CurationSet) -> None: |
121 | 122 | assert res == json_response |
122 | 123 |
|
123 | 124 |
|
| 125 | +def test_actual_retrieve( |
| 126 | + actual_curation_sets: CurationSets, |
| 127 | + delete_all_curation_sets: None, |
| 128 | + create_curation_set: None, |
| 129 | +) -> None: |
| 130 | + """Test that the CurationSet object can retrieve a curation set from Typesense Server.""" |
| 131 | + response = actual_curation_sets["products"].retrieve() |
| 132 | + |
| 133 | + assert response == { |
| 134 | + "items": [ |
| 135 | + { |
| 136 | + "excludes": [ |
| 137 | + { |
| 138 | + "id": "999", |
| 139 | + }, |
| 140 | + ], |
| 141 | + "filter_curated_hits": False, |
| 142 | + "id": "rule-1", |
| 143 | + "includes": [ |
| 144 | + { |
| 145 | + "id": "123", |
| 146 | + "position": 1, |
| 147 | + }, |
| 148 | + ], |
| 149 | + "remove_matched_tokens": False, |
| 150 | + "rule": { |
| 151 | + "match": "contains", |
| 152 | + "query": "shoe", |
| 153 | + }, |
| 154 | + "stop_processing": True, |
| 155 | + }, |
| 156 | + ], |
| 157 | + "name": "products", |
| 158 | + } |
| 159 | + |
| 160 | + |
| 161 | +def test_actual_delete( |
| 162 | + actual_curation_sets: CurationSets, |
| 163 | + create_curation_set: None, |
| 164 | +) -> None: |
| 165 | + """Test that the CurationSet object can delete a curation set from Typesense Server.""" |
| 166 | + response = actual_curation_sets["products"].delete() |
| 167 | + |
| 168 | + print(response) |
| 169 | + assert response == {"name": "products"} |
0 commit comments