@@ -77,7 +77,7 @@ t.test('token list', async t => {
77
77
return { token : 'thisisnotarealtoken' }
78
78
} ,
79
79
profile : {
80
- listTokens : conf => {
80
+ listTokens : async conf => {
81
81
t . same ( conf . auth , { token : 'thisisnotarealtoken' , otp : '123456' } )
82
82
return tokens
83
83
} ,
@@ -118,7 +118,7 @@ t.test('token list json output', async t => {
118
118
return { username : 'foo' , password : 'bar' }
119
119
} ,
120
120
profile : {
121
- listTokens : conf => {
121
+ listTokens : async conf => {
122
122
t . same (
123
123
conf . auth ,
124
124
{ basic : { username : 'foo' , password : 'bar' } } ,
@@ -164,7 +164,7 @@ t.test('token list parseable output', async t => {
164
164
return { auth : Buffer . from ( 'foo:bar' ) . toString ( 'base64' ) }
165
165
} ,
166
166
profile : {
167
- listTokens : conf => {
167
+ listTokens : async conf => {
168
168
t . same (
169
169
conf . auth ,
170
170
{ basic : { username : 'foo' , password : 'bar' } } ,
@@ -212,11 +212,11 @@ t.test('token revoke', async t => {
212
212
return { }
213
213
} ,
214
214
profile : {
215
- listTokens : conf => {
215
+ listTokens : async conf => {
216
216
t . same ( conf . auth , { } , 'passes the correct empty auth' )
217
217
return Promise . resolve ( [ { key : 'abcd1234' } ] )
218
218
} ,
219
- removeToken : key => {
219
+ removeToken : async key => {
220
220
t . equal ( key , 'abcd1234' , 'deletes the correct token' )
221
221
} ,
222
222
} ,
@@ -235,8 +235,8 @@ t.test('token revoke multiple tokens', async t => {
235
235
return { token : 'thisisnotarealtoken' }
236
236
} ,
237
237
profile : {
238
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' } , { key : 'efgh5678' } ] ) ,
239
- removeToken : key => {
238
+ listTokens : async ( ) => ( [ { key : 'abcd1234' } , { key : 'efgh5678' } ] ) ,
239
+ removeToken : async key => {
240
240
// this will run twice
241
241
t . ok ( [ 'abcd1234' , 'efgh5678' ] . includes ( key ) , 'deletes the correct token' )
242
242
} ,
@@ -256,8 +256,8 @@ t.test('token revoke json output', async t => {
256
256
return { token : 'thisisnotarealtoken' }
257
257
} ,
258
258
profile : {
259
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' } ] ) ,
260
- removeToken : key => {
259
+ listTokens : async ( ) => ( [ { key : 'abcd1234' } ] ) ,
260
+ removeToken : async key => {
261
261
t . equal ( key , 'abcd1234' , 'deletes the correct token' )
262
262
} ,
263
263
} ,
@@ -278,8 +278,8 @@ t.test('token revoke parseable output', async t => {
278
278
return { token : 'thisisnotarealtoken' }
279
279
} ,
280
280
profile : {
281
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' } ] ) ,
282
- removeToken : key => {
281
+ listTokens : async ( ) => ( [ { key : 'abcd1234' } ] ) ,
282
+ removeToken : async key => {
283
283
t . equal ( key , 'abcd1234' , 'deletes the correct token' )
284
284
} ,
285
285
} ,
@@ -298,8 +298,8 @@ t.test('token revoke by token', async t => {
298
298
return { token : 'thisisnotarealtoken' }
299
299
} ,
300
300
profile : {
301
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' , token : 'efgh5678' } ] ) ,
302
- removeToken : key => {
301
+ listTokens : async ( ) => ( [ { key : 'abcd1234' , token : 'efgh5678' } ] ) ,
302
+ removeToken : async key => {
303
303
t . equal ( key , 'efgh5678' , 'passes through user input' )
304
304
} ,
305
305
} ,
@@ -323,7 +323,7 @@ t.test('token revoke ambiguous id errors', async t => {
323
323
return { token : 'thisisnotarealtoken' }
324
324
} ,
325
325
profile : {
326
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' } , { key : 'abcd5678' } ] ) ,
326
+ listTokens : async ( ) => ( [ { key : 'abcd1234' } , { key : 'abcd5678' } ] ) ,
327
327
} ,
328
328
} )
329
329
@@ -338,7 +338,7 @@ t.test('token revoke unknown id errors', async t => {
338
338
return { token : 'thisisnotarealtoken' }
339
339
} ,
340
340
profile : {
341
- listTokens : ( ) => Promise . resolve ( [ { key : 'abcd1234' } ] ) ,
341
+ listTokens : async ( ) => ( [ { key : 'abcd1234' } ] ) ,
342
342
} ,
343
343
} )
344
344
@@ -362,7 +362,7 @@ t.test('token create', async t => {
362
362
password : ( ) => Promise . resolve ( password ) ,
363
363
} ,
364
364
profile : {
365
- createToken : ( pw , readonly , cidr ) => {
365
+ createToken : async ( pw , readonly , cidr ) => {
366
366
t . equal ( pw , password )
367
367
t . equal ( readonly , false )
368
368
t . same ( cidr , [ '10.0.0.0/8' , '192.168.1.0/24' ] , 'defaults to empty array' )
@@ -405,7 +405,7 @@ t.test('token create json output', async t => {
405
405
password : ( ) => Promise . resolve ( password ) ,
406
406
} ,
407
407
profile : {
408
- createToken : ( pw , readonly , cidr ) => {
408
+ createToken : async ( pw , readonly , cidr ) => {
409
409
t . equal ( pw , password )
410
410
t . equal ( readonly , false )
411
411
t . same ( cidr , [ ] , 'defaults to empty array' )
@@ -447,7 +447,7 @@ t.test('token create parseable output', async t => {
447
447
password : ( ) => Promise . resolve ( password ) ,
448
448
} ,
449
449
profile : {
450
- createToken : ( pw , readonly , cidr ) => {
450
+ createToken : async ( pw , readonly , cidr ) => {
451
451
t . equal ( pw , password )
452
452
t . equal ( readonly , false )
453
453
t . same ( cidr , [ ] , 'defaults to empty array' )
0 commit comments