Skip to content

Commit 7a0dcc2

Browse files
committed
test(curation_set): add integration tests for curation set
1 parent 8e11da7 commit 7a0dcc2

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/curation_set_test.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from tests.utils.version import is_v30_or_above
99
from typesense.client import Client
1010
from typesense.curation_set import CurationSet
11+
from typesense.curation_sets import CurationSets
1112
from typesense.types.curation_set import (
1213
CurationItemDeleteSchema,
1314
CurationItemSchema,
@@ -121,3 +122,48 @@ def test_delete_item(fake_curation_set: CurationSet) -> None:
121122
assert res == json_response
122123

123124

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

Comments
 (0)