@@ -246,45 +246,6 @@ func TestAPIKey_Deleted(t *testing.T) {
246
246
require .Equal (t , http .StatusBadRequest , apiErr .StatusCode ())
247
247
}
248
248
249
- func TestAPIKey_Refresh (t * testing.T ) {
250
- t .Parallel ()
251
-
252
- db , pubsub := dbtestutil .NewDB (t )
253
- client := coderdtest .New (t , & coderdtest.Options {
254
- Database : db ,
255
- Pubsub : pubsub ,
256
- })
257
- owner := coderdtest .CreateFirstUser (t , client )
258
-
259
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
260
- defer cancel ()
261
-
262
- token , err := client .CreateAPIKey (ctx , owner .UserID .String ())
263
- require .NoError (t , err )
264
- split := strings .Split (token .Key , "-" )
265
- apiKey1 , err := db .GetAPIKeyByID (ctx , split [0 ])
266
- require .NoError (t , err )
267
- require .Equal (t , int64 (604800 ), apiKey1 .LifetimeSeconds , "default should be 7 days" )
268
-
269
- err = db .UpdateAPIKeyByID (ctx , database.UpdateAPIKeyByIDParams {
270
- ID : apiKey1 .ID ,
271
- LastUsed : apiKey1 .LastUsed ,
272
- // Cross the no-refresh threshold
273
- ExpiresAt : apiKey1 .ExpiresAt .Add (time .Hour * - 2 ),
274
- IPAddress : apiKey1 .IPAddress ,
275
- })
276
- require .NoError (t , err , "update login key" )
277
-
278
- // Refresh the token
279
- client .SetSessionToken (token .Key )
280
- _ , err = client .User (ctx , codersdk .Me )
281
- require .NoError (t , err )
282
-
283
- apiKey2 , err := client .APIKeyByID (ctx , owner .UserID .String (), split [0 ])
284
- require .NoError (t , err )
285
- require .True (t , apiKey2 .ExpiresAt .After (apiKey1 .ExpiresAt ), "token should have a later expiry" )
286
- }
287
-
288
249
func TestAPIKey_SetDefault (t * testing.T ) {
289
250
t .Parallel ()
290
251
0 commit comments