Skip to content

Commit 437de4e

Browse files
committed
feat(cts): add test for the helper
1 parent 44ada68 commit 437de4e

File tree

12 files changed

+126
-0
lines changed

12 files changed

+126
-0
lines changed

specs/abtesting/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ paths:
9999
$ref: 'paths/stopABTest.yml'
100100
/2/abtests/schedule:
101101
$ref: 'paths/scheduleABTest.yml'
102+
103+
# ###############
104+
# ### Helpers ###
105+
# ###############
106+
/setAlgoliaApiKey:
107+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/analytics/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,9 @@ paths:
166166
# ########################
167167
/2/status:
168168
$ref: 'paths/status/getStatus.yml'
169+
170+
# ###############
171+
# ### Helpers ###
172+
# ###############
173+
/setAlgoliaApiKey:
174+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
method:
2+
get:
3+
x-helper: true
4+
x-asynchronous-helper: false
5+
tags:
6+
- Api Key
7+
operationId: setAlgoliaApiKey
8+
summary: Switch the API key used to authenticate requests
9+
description: |
10+
Switch the API key used to authenticate requests.
11+
parameters:
12+
- in: query
13+
name: apiKey
14+
description: API key to be used from now on.
15+
required: true
16+
schema:
17+
type: string
18+
responses:
19+
'200':
20+
description: OK
21+
content:
22+
application/json:
23+
schema:
24+
type: string
25+
'400':
26+
$ref: '../../common/responses/IndexNotFound.yml'

specs/ingestion/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,9 @@ paths:
191191
$ref: 'paths/runs/events/events.yml'
192192
/1/runs/{runID}/events/{eventID}:
193193
$ref: 'paths/runs/events/eventID.yml'
194+
195+
# ###############
196+
# ### Helpers ###
197+
# ###############
198+
/setAlgoliaApiKey:
199+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/insights/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,9 @@ paths:
101101

102102
/1/usertokens/{userToken}:
103103
$ref: 'paths/deleteUserToken.yml'
104+
105+
# ###############
106+
# ### Helpers ###
107+
# ###############
108+
/setAlgoliaApiKey:
109+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/monitoring/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@ paths:
9797
$ref: 'paths/getReachability.yml'
9898
/1/infrastructure/{metric}/period/{period}:
9999
$ref: 'paths/getMetrics.yml'
100+
101+
# ###############
102+
# ### Helpers ###
103+
# ###############
104+
/setAlgoliaApiKey:
105+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/personalization/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ paths:
9292
$ref: 'paths/deleteUserProfile.yml'
9393
/1/strategies/personalization:
9494
$ref: 'paths/personalizationStrategy.yml'
95+
96+
# ###############
97+
# ### Helpers ###
98+
# ###############
99+
/setAlgoliaApiKey:
100+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/query-suggestions/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ paths:
9292
$ref: 'paths/getConfigurationStatus.yml'
9393
/1/logs/{indexName}:
9494
$ref: 'paths/getLogFile.yml'
95+
96+
# ###############
97+
# ### Helpers ###
98+
# ###############
99+
/setAlgoliaApiKey:
100+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/recommend/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ paths:
131131

132132
/1/indexes/{indexName}/{model}/recommend/rules/search:
133133
$ref: 'paths/searchRecommendRules.yml'
134+
135+
# ###############
136+
# ### Helpers ###
137+
# ###############
138+
/setAlgoliaApiKey:
139+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/search/spec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,6 @@ paths:
390390

391391
/indexExists:
392392
$ref: 'helpers/indexExists.yml#/method'
393+
394+
/setAlgoliaApiKey:
395+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'

specs/usage/spec.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ paths:
6363
$ref: 'paths/statistic.yml'
6464
/1/usage/{statistic}/{indexName}:
6565
$ref: 'paths/statisticIndex.yml'
66+
67+
# ###############
68+
# ### Helpers ###
69+
# ###############
70+
/setAlgoliaApiKey:
71+
$ref: '../common/helpers/setAlgoliaApiKey.yml#/method'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"testName": "switch API key",
4+
"steps": [
5+
{
6+
"type": "createClient",
7+
"parameters": {
8+
"appId": "test-app-id",
9+
"apiKey": "test-api-key"
10+
}
11+
},
12+
{
13+
"type": "method",
14+
"method": "customGet",
15+
"parameters": {
16+
"path": "check-api-key"
17+
},
18+
"expected": {
19+
"type": "response",
20+
"match": "test-api-key"
21+
}
22+
},
23+
{
24+
"type": "method",
25+
"method": "setAlgoliaApiKey",
26+
"parameters": {
27+
"apiKey": "updated-api-key"
28+
}
29+
},
30+
{
31+
"type": "method",
32+
"method": "customGet",
33+
"parameters": {
34+
"path": "check-api-key"
35+
},
36+
"expected": {
37+
"type": "response",
38+
"match": "updated-api-key"
39+
}
40+
}
41+
]
42+
}
43+
]

0 commit comments

Comments
 (0)