mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
refactor(coderd/database): split Time
and Now
into dbtime
package (#9482)
Ref: #9380
This commit is contained in:
committed by
GitHub
parent
702b064cac
commit
19d7da3d24
@ -12,6 +12,7 @@ import (
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbfake"
|
||||
"github.com/coder/coder/v2/coderd/database/dbgen"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
"github.com/coder/coder/v2/testutil"
|
||||
)
|
||||
|
||||
@ -32,7 +33,7 @@ func TestObtainOIDCAccessToken(t *testing.T) {
|
||||
dbgen.UserLink(t, db, database.UserLink{
|
||||
UserID: user.ID,
|
||||
LoginType: database.LoginTypeOIDC,
|
||||
OAuthExpiry: database.Now().Add(-time.Hour),
|
||||
OAuthExpiry: dbtime.Now().Add(-time.Hour),
|
||||
})
|
||||
_, err := obtainOIDCAccessToken(ctx, db, &oauth2.Config{}, user.ID)
|
||||
require.NoError(t, err)
|
||||
@ -44,7 +45,7 @@ func TestObtainOIDCAccessToken(t *testing.T) {
|
||||
dbgen.UserLink(t, db, database.UserLink{
|
||||
UserID: user.ID,
|
||||
LoginType: database.LoginTypeOIDC,
|
||||
OAuthExpiry: database.Now().Add(-time.Hour),
|
||||
OAuthExpiry: dbtime.Now().Add(-time.Hour),
|
||||
})
|
||||
_, err := obtainOIDCAccessToken(ctx, db, &testutil.OAuth2Config{
|
||||
Token: &oauth2.Token{
|
||||
|
Reference in New Issue
Block a user