mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
chore(site): remove dbmem from tests (#18802)
Related to https://github.com/coder/coder/issues/15109.
This commit is contained in:
@ -27,7 +27,6 @@ import (
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/db2sdk"
|
||||
"github.com/coder/coder/v2/coderd/database/dbgen"
|
||||
"github.com/coder/coder/v2/coderd/database/dbmem"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtestutil"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
"github.com/coder/coder/v2/coderd/httpmw"
|
||||
@ -46,7 +45,7 @@ func TestInjection(t *testing.T) {
|
||||
},
|
||||
}
|
||||
binFs := http.FS(fstest.MapFS{})
|
||||
db := dbmem.New()
|
||||
db, _ := dbtestutil.NewDB(t)
|
||||
handler := site.New(&site.Options{
|
||||
Telemetry: telemetry.NewNoop(),
|
||||
BinFS: binFs,
|
||||
@ -73,13 +72,17 @@ func TestInjection(t *testing.T) {
|
||||
// This will update as part of the request!
|
||||
got.LastSeenAt = user.LastSeenAt
|
||||
|
||||
// json.Unmarshal doesn't parse the timezone correctly
|
||||
got.CreatedAt = got.CreatedAt.In(user.CreatedAt.Location())
|
||||
got.UpdatedAt = got.UpdatedAt.In(user.CreatedAt.Location())
|
||||
|
||||
require.Equal(t, db2sdk.User(user, []uuid.UUID{}), got)
|
||||
}
|
||||
|
||||
func TestInjectionFailureProducesCleanHTML(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
db := dbmem.New()
|
||||
db, _ := dbtestutil.NewDB(t)
|
||||
|
||||
// Create an expired user with a refresh token, but provide no OAuth2
|
||||
// configuration so that refresh is impossible, this should result in
|
||||
|
Reference in New Issue
Block a user