MCPcopy
hub / github.com/tsuru/tsuru / TestGetTokenNoExpiration

Method TestGetTokenNoExpiration

auth/native/token_test.go:349–367  ·  view source on GitHub ↗
(c *check.C)

Source from the content-addressed store, hash-verified

347}
348
349func (s *S) TestGetTokenNoExpiration(c *check.C) {
350 ctx := context.TODO()
351 tokensCollection, err := storagev2.TokensCollection()
352 c.Assert(err, check.IsNil)
353
354 t := Token{
355 Token: "tsuru-healer",
356 Creation: time.Now(),
357 Expires: 0,
358 }
359 defer tokensCollection.DeleteOne(ctx, mongoBSON.M{"token": t.Token})
360 t.Creation = time.Now().Add(-24 * time.Hour)
361 _, err = tokensCollection.InsertOne(ctx, t)
362 c.Assert(err, check.IsNil)
363
364 t2, err := getToken(ctx, t.Token)
365 c.Assert(err, check.IsNil)
366 c.Assert(t2.GetValue(), check.DeepEquals, t.GetValue())
367}
368
369func (s *S) TestDeleteToken(c *check.C) {
370 ctx := context.TODO()

Callers

nothing calls this directly

Calls 5

GetValueMethod · 0.95
TokensCollectionFunction · 0.92
getTokenFunction · 0.70
AddMethod · 0.65
GetValueMethod · 0.65

Tested by

no test coverage detected