Skip to content

Commit 5066eb8

Browse files
committed
add additional tests
1 parent 6f9eb00 commit 5066eb8

File tree

3 files changed

+489
-17
lines changed

3 files changed

+489
-17
lines changed

tests/CTS/requests/composition-full/multipleBatch.json

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,249 @@
6262
]
6363
}
6464
}
65+
},
66+
67+
{
68+
"parameters": {
69+
"requests": [
70+
{
71+
"action": "upsert",
72+
"body": {
73+
"objectID": "my-external-injection-compo",
74+
"name": "my first composition",
75+
"behavior": {
76+
"injection": {
77+
"main": {
78+
"source": {
79+
"search": {
80+
"index": "foo"
81+
}
82+
}
83+
},
84+
"injectedItems": [
85+
{
86+
"key": "injectedItem1",
87+
"source": {
88+
"external": {
89+
"index": "foo",
90+
"ordering": "userDefined",
91+
"params": {
92+
"filters": "brand:adidas"
93+
}
94+
}
95+
},
96+
"position": 2,
97+
"length": 1
98+
}
99+
]
100+
}
101+
}
102+
}
103+
}
104+
]
105+
},
106+
"request": {
107+
"path": "/1/compositions/*/batch",
108+
"method": "POST",
109+
"body": {
110+
"requests": [
111+
{
112+
"action": "upsert",
113+
"body": {
114+
"objectID": "my-external-injection-compo",
115+
"name": "my first composition",
116+
"behavior": {
117+
"injection": {
118+
"main": {
119+
"source": {
120+
"search": {
121+
"index": "foo"
122+
}
123+
}
124+
},
125+
"injectedItems": [
126+
{
127+
"key": "injectedItem1",
128+
"source": {
129+
"external": {
130+
"index": "foo",
131+
"ordering": "userDefined",
132+
"params": {
133+
"filters": "brand:adidas"
134+
}
135+
}
136+
},
137+
"position": 2,
138+
"length": 1
139+
}
140+
]
141+
}
142+
}
143+
}
144+
}
145+
]
146+
}
147+
}
148+
},
149+
150+
{
151+
"parameters": {
152+
"requests": [
153+
{
154+
"action": "upsert",
155+
"body": {
156+
"objectID": "my-metadata-compo",
157+
"name": "my composition",
158+
"behavior": {
159+
"injection": {
160+
"main": {
161+
"source": {
162+
"search": {
163+
"index": "foo",
164+
"params": { "filters": "brand:adidas" }
165+
}
166+
}
167+
},
168+
"injectedItems": [
169+
{
170+
"key": "injectedItem1",
171+
"source": {
172+
"search": {
173+
"index": "foo",
174+
"params": {
175+
"filters": "brand:adidas"
176+
}
177+
}
178+
},
179+
"position": 2,
180+
"length": 1,
181+
"metadata": {
182+
"hits": {
183+
"addItemKey": true,
184+
"extra": {
185+
"my-string": "string",
186+
"my-bool": true,
187+
"my-number": 42,
188+
"my-object": { "sub-key": "sub-value" },
189+
"my-array": [1, 2, 3],
190+
"my-empty-object": {}
191+
}
192+
}
193+
}
194+
},
195+
{
196+
"key": "externalItem",
197+
"source": {
198+
"search": {
199+
"index": "foo",
200+
"params": {
201+
"filters": "brand:puma"
202+
}
203+
}
204+
},
205+
"position": 5,
206+
"length": 5,
207+
"metadata": {
208+
"hits": {
209+
"addItemKey": true,
210+
"extra": {
211+
"my-string": "string",
212+
"my-bool": true,
213+
"my-number": 42,
214+
"my-object": { "sub-key": "sub-value" },
215+
"my-array": [1, 2, 3],
216+
"my-empty-object": {}
217+
}
218+
}
219+
}
220+
}
221+
]
222+
}
223+
}
224+
}
225+
}
226+
]
227+
},
228+
"request": {
229+
"path": "/1/compositions/*/batch",
230+
"method": "POST",
231+
"body": {
232+
"requests": [
233+
{
234+
"action": "upsert",
235+
"body": {
236+
"objectID": "my-metadata-compo",
237+
"name": "my composition",
238+
"behavior": {
239+
"injection": {
240+
"main": {
241+
"source": {
242+
"search": {
243+
"index": "foo",
244+
"params": { "filters": "brand:adidas" }
245+
}
246+
}
247+
},
248+
"injectedItems": [
249+
{
250+
"key": "injectedItem1",
251+
"source": {
252+
"search": {
253+
"index": "foo",
254+
"params": {
255+
"filters": "brand:adidas"
256+
}
257+
}
258+
},
259+
"position": 2,
260+
"length": 1,
261+
"metadata": {
262+
"hits": {
263+
"addItemKey": true,
264+
"extra": {
265+
"my-string": "string",
266+
"my-bool": true,
267+
"my-number": 42,
268+
"my-object": { "sub-key": "sub-value" },
269+
"my-array": [1, 2, 3],
270+
"my-empty-object": {}
271+
}
272+
}
273+
}
274+
},
275+
{
276+
"key": "externalItem",
277+
"source": {
278+
"search": {
279+
"index": "foo",
280+
"params": {
281+
"filters": "brand:puma"
282+
}
283+
}
284+
},
285+
"position": 5,
286+
"length": 5,
287+
"metadata": {
288+
"hits": {
289+
"addItemKey": true,
290+
"extra": {
291+
"my-string": "string",
292+
"my-bool": true,
293+
"my-number": 42,
294+
"my-object": { "sub-key": "sub-value" },
295+
"my-array": [1, 2, 3],
296+
"my-empty-object": {}
297+
}
298+
}
299+
}
300+
}
301+
]
302+
}
303+
}
304+
}
305+
}
306+
]
307+
}
308+
}
65309
}
66310
]

tests/CTS/requests/composition-full/putCompositionRule.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[
22
{
33
"parameters": {
4-
"compositionID": "1234",
5-
"objectID": "5678",
4+
"compositionID": "compositionID",
5+
"objectID": "ruleID",
66
"compositionRule": {
7-
"objectID": "5678",
7+
"objectID": "ruleID",
88
"conditions": [
99
{
1010
"anchoring": "is",
@@ -39,10 +39,10 @@
3939
}
4040
},
4141
"request": {
42-
"path": "/1/compositions/1234/rules/5678",
42+
"path": "/1/compositions/compositionID/rules/ruleID",
4343
"method": "PUT",
4444
"body": {
45-
"objectID": "5678",
45+
"objectID": "ruleID",
4646
"conditions": [
4747
{
4848
"anchoring": "is",
@@ -81,9 +81,9 @@
8181
{
8282
"parameters": {
8383
"compositionID": "compositionID",
84-
"objectID": "ruleID",
84+
"objectID": "rule-with-metadata",
8585
"compositionRule": {
86-
"objectID": "ruleID",
86+
"objectID": "rule-with-metadata",
8787
"conditions": [
8888
{
8989
"anchoring": "is",
@@ -134,10 +134,10 @@
134134
}
135135
},
136136
"request": {
137-
"path": "/1/compositions/compositionID/rules/ruleID",
137+
"path": "/1/compositions/compositionID/rules/rule-with-metadata",
138138
"method": "PUT",
139139
"body": {
140-
"objectID": "ruleID",
140+
"objectID": "rule-with-metadata",
141141
"conditions": [
142142
{
143143
"anchoring": "is",
@@ -192,9 +192,9 @@
192192
{
193193
"parameters": {
194194
"compositionID": "compositionID",
195-
"objectID": "ruleID",
195+
"objectID": "rule-with-exernal-source",
196196
"compositionRule": {
197-
"objectID": "ruleID",
197+
"objectID": "rule-with-exernal-source",
198198
"description": "my description",
199199
"tags": ["tag1", "tag2"],
200200
"enabled": true,
@@ -218,9 +218,10 @@
218218
{
219219
"key": "injectedItem",
220220
"source": {
221-
"search": {
221+
"external": {
222222
"index": "my-index",
223-
"params": { "filters": "brand:adidas" }
223+
"params": { "filters": "brand:adidas" },
224+
"ordering": "userDefined"
224225
}
225226
},
226227
"position": 0,
@@ -233,10 +234,10 @@
233234
}
234235
},
235236
"request": {
236-
"path": "/1/compositions/compositionID/rules/ruleID",
237+
"path": "/1/compositions/compositionID/rules/rule-with-exernal-source",
237238
"method": "PUT",
238239
"body": {
239-
"objectID": "ruleID",
240+
"objectID": "rule-with-exernal-source",
240241
"description": "my description",
241242
"tags": ["tag1", "tag2"],
242243
"enabled": true,
@@ -260,9 +261,10 @@
260261
{
261262
"key": "injectedItem",
262263
"source": {
263-
"search": {
264+
"external": {
264265
"index": "my-index",
265-
"params": { "filters": "brand:adidas" }
266+
"params": { "filters": "brand:adidas" },
267+
"ordering": "userDefined"
266268
}
267269
},
268270
"position": 0,

0 commit comments

Comments
 (0)