@@ -94,6 +94,41 @@ describe('apigw', () => {
94
94
registerFunctionName : 'myRestAPI' ,
95
95
} ,
96
96
} ,
97
+ // below two api is for oauth2.0 test
98
+ {
99
+ path : '/oauth' ,
100
+ protocol : 'HTTP' ,
101
+ method : 'GET' ,
102
+ apiName : 'oauthapi' ,
103
+ authType : 'OAUTH' ,
104
+ businessType : 'OAUTH' ,
105
+ serviceType : 'HTTP' ,
106
+ serviceConfig : {
107
+ method : 'GET' ,
108
+ path : '/check' ,
109
+ url : 'http://10.64.47.103:9090' ,
110
+ } ,
111
+ oauthConfig : {
112
+ loginRedirectUrl : 'http://10.64.47.103:9090/code' ,
113
+ publicKey : process . env . API_PUBLIC_KEY ,
114
+ tokenLocation : 'method.req.header.authorization' ,
115
+ // tokenLocation: 'method.req.header.cookie',
116
+ } ,
117
+ } ,
118
+ {
119
+ path : '/oauthwork' ,
120
+ protocol : 'HTTP' ,
121
+ method : 'GET' ,
122
+ apiName : 'business' ,
123
+ authType : 'OAUTH' ,
124
+ businessType : 'NORMAL' ,
125
+ authRelationApi : {
126
+ path : '/oauth' ,
127
+ method : 'GET' ,
128
+ } ,
129
+ serviceType : 'MOCK' ,
130
+ serviceMockReturnMessage : 'helloworld' ,
131
+ } ,
97
132
] ,
98
133
} ;
99
134
const apigw = new Apigw ( credentials , process . env . REGION ) ;
@@ -125,6 +160,8 @@ describe('apigw', () => {
125
160
apiName : 'index' ,
126
161
apiId : expect . stringContaining ( 'api-' ) ,
127
162
created : true ,
163
+ authType : 'NONE' ,
164
+ businessType : 'NORMAL' ,
128
165
} ,
129
166
{
130
167
path : '/mo' ,
@@ -133,6 +170,8 @@ describe('apigw', () => {
133
170
internalDomain : expect . any ( String ) ,
134
171
apiId : expect . stringContaining ( 'api-' ) ,
135
172
created : true ,
173
+ authType : 'NONE' ,
174
+ businessType : 'NORMAL' ,
136
175
} ,
137
176
{
138
177
path : '/auto' ,
@@ -141,6 +180,8 @@ describe('apigw', () => {
141
180
internalDomain : expect . any ( String ) ,
142
181
apiId : expect . stringContaining ( 'api-' ) ,
143
182
created : true ,
183
+ authType : 'NONE' ,
184
+ businessType : 'NORMAL' ,
144
185
} ,
145
186
{
146
187
path : '/ws' ,
@@ -149,6 +190,8 @@ describe('apigw', () => {
149
190
internalDomain : expect . any ( String ) ,
150
191
apiId : expect . stringContaining ( 'api-' ) ,
151
192
created : true ,
193
+ authType : 'NONE' ,
194
+ businessType : 'NORMAL' ,
152
195
} ,
153
196
{
154
197
path : '/wsf' ,
@@ -159,6 +202,29 @@ describe('apigw', () => {
159
202
) ,
160
203
apiId : expect . stringContaining ( 'api-' ) ,
161
204
created : true ,
205
+ authType : 'NONE' ,
206
+ businessType : 'NORMAL' ,
207
+ } ,
208
+ {
209
+ path : '/oauth' ,
210
+ method : 'GET' ,
211
+ apiName : 'oauthapi' ,
212
+ apiId : expect . stringContaining ( 'api-' ) ,
213
+ created : true ,
214
+ authType : 'OAUTH' ,
215
+ businessType : 'OAUTH' ,
216
+ internalDomain : expect . any ( String ) ,
217
+ } ,
218
+ {
219
+ path : '/oauthwork' ,
220
+ method : 'GET' ,
221
+ apiName : 'business' ,
222
+ apiId : expect . stringContaining ( 'api-' ) ,
223
+ created : true ,
224
+ authType : 'OAUTH' ,
225
+ businessType : 'NORMAL' ,
226
+ authRelationApiId : expect . stringContaining ( 'api-' ) ,
227
+ internalDomain : expect . any ( String ) ,
162
228
} ,
163
229
] ,
164
230
} ) ;
@@ -197,6 +263,8 @@ describe('apigw', () => {
197
263
apiName : 'index' ,
198
264
apiId : expect . stringContaining ( 'api-' ) ,
199
265
created : true ,
266
+ authType : 'SECRET' ,
267
+ businessType : 'NORMAL' ,
200
268
usagePlan : {
201
269
created : true ,
202
270
secrets : {
@@ -213,6 +281,8 @@ describe('apigw', () => {
213
281
internalDomain : expect . any ( String ) ,
214
282
apiId : expect . stringContaining ( 'api-' ) ,
215
283
created : true ,
284
+ authType : 'NONE' ,
285
+ businessType : 'NORMAL' ,
216
286
} ,
217
287
{
218
288
path : '/auto' ,
@@ -221,13 +291,17 @@ describe('apigw', () => {
221
291
internalDomain : expect . any ( String ) ,
222
292
apiId : expect . stringContaining ( 'api-' ) ,
223
293
created : true ,
294
+ authType : 'NONE' ,
295
+ businessType : 'NORMAL' ,
224
296
} ,
225
297
{
226
298
path : '/ws' ,
227
299
method : 'GET' ,
228
300
apiName : 'ws-test' ,
229
301
internalDomain : expect . any ( String ) ,
230
302
apiId : expect . stringContaining ( 'api-' ) ,
303
+ authType : 'NONE' ,
304
+ businessType : 'NORMAL' ,
231
305
created : true ,
232
306
} ,
233
307
{
@@ -238,7 +312,30 @@ describe('apigw', () => {
238
312
'http://set-websocket.cb-common.apigateway.tencentyun.com' ,
239
313
) ,
240
314
apiId : expect . stringContaining ( 'api-' ) ,
315
+ authType : 'NONE' ,
316
+ businessType : 'NORMAL' ,
317
+ created : true ,
318
+ } ,
319
+ {
320
+ path : '/oauth' ,
321
+ method : 'GET' ,
322
+ apiName : 'oauthapi' ,
323
+ apiId : expect . stringContaining ( 'api-' ) ,
324
+ created : true ,
325
+ authType : 'OAUTH' ,
326
+ businessType : 'OAUTH' ,
327
+ internalDomain : expect . any ( String ) ,
328
+ } ,
329
+ {
330
+ path : '/oauthwork' ,
331
+ method : 'GET' ,
332
+ apiName : 'business' ,
333
+ apiId : expect . stringContaining ( 'api-' ) ,
241
334
created : true ,
335
+ authType : 'OAUTH' ,
336
+ businessType : 'NORMAL' ,
337
+ authRelationApiId : expect . stringContaining ( 'api-' ) ,
338
+ internalDomain : expect . any ( String ) ,
242
339
} ,
243
340
] ,
244
341
} ) ;
0 commit comments