(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestShouldRefreshOIDCToken(t *testing.T) { |
| 52 | t.Parallel() |
| 53 | |
| 54 | now := dbtime.Now() |
| 55 | cases := []struct { |
| 56 | name string |
| 57 | link database.UserLink |
| 58 | want bool |
| 59 | }{ |
| 60 | { |
| 61 | name: "NoRefreshToken", |
| 62 | link: database.UserLink{OAuthExpiry: now.Add(-time.Hour)}, |
| 63 | }, |
| 64 | { |
| 65 | name: "ZeroExpiry", |
| 66 | link: database.UserLink{OAuthRefreshToken: "refresh"}, |
| 67 | }, |
| 68 | { |
| 69 | name: "Expired", |
| 70 | link: database.UserLink{ |
| 71 | OAuthRefreshToken: "refresh", |
| 72 | OAuthExpiry: now.Add(-time.Hour), |
| 73 | }, |
| 74 | want: true, |
| 75 | }, |
| 76 | { |
| 77 | name: "Fresh", |
| 78 | link: database.UserLink{ |
| 79 | OAuthRefreshToken: "refresh", |
| 80 | OAuthExpiry: now.Add(time.Hour), |
| 81 | }, |
| 82 | }, |
| 83 | } |
| 84 | |
| 85 | for _, tc := range cases { |
| 86 | t.Run(tc.name, func(t *testing.T) { |
| 87 | t.Parallel() |
| 88 | got, _ := shouldRefreshOIDCToken(tc.link) |
| 89 | require.Equal(t, tc.want, got) |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestOIDCMCPTokenSource(t *testing.T) { |
| 95 | t.Parallel() |
nothing calls this directly
no test coverage detected