mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: Add more objects to dbgen (#6013)
* chore: Add WorkspaceApps to dbgen * GitSSHKey, UserLink, GitAuthLink
This commit is contained in:
@ -44,6 +44,16 @@ func TestGenerator(t *testing.T) {
|
||||
require.Equal(t, exp, must(db.GetUserLinkByLinkedID(context.Background(), exp.LinkedID)))
|
||||
})
|
||||
|
||||
t.Run("GitAuthLink", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbfake.New()
|
||||
exp := dbgen.GitAuthLink(t, db, database.GitAuthLink{})
|
||||
require.Equal(t, exp, must(db.GetGitAuthLink(context.Background(), database.GetGitAuthLinkParams{
|
||||
ProviderID: exp.ProviderID,
|
||||
UserID: exp.UserID,
|
||||
})))
|
||||
})
|
||||
|
||||
t.Run("WorkspaceResource", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbfake.New()
|
||||
@ -51,6 +61,13 @@ func TestGenerator(t *testing.T) {
|
||||
require.Equal(t, exp, must(db.GetWorkspaceResourceByID(context.Background(), exp.ID)))
|
||||
})
|
||||
|
||||
t.Run("WorkspaceApp", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbfake.New()
|
||||
exp := dbgen.WorkspaceApp(t, db, database.WorkspaceApp{})
|
||||
require.Equal(t, exp, must(db.GetWorkspaceAppsByAgentID(context.Background(), exp.AgentID))[0])
|
||||
})
|
||||
|
||||
t.Run("WorkspaceResourceMetadatum", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbfake.New()
|
||||
@ -159,6 +176,13 @@ func TestGenerator(t *testing.T) {
|
||||
exp := dbgen.User(t, db, database.User{})
|
||||
require.Equal(t, exp, must(db.GetUserByID(context.Background(), exp.ID)))
|
||||
})
|
||||
|
||||
t.Run("SSHKey", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db := dbfake.New()
|
||||
exp := dbgen.GitSSHKey(t, db, database.GitSSHKey{})
|
||||
require.Equal(t, exp, must(db.GetGitSSHKey(context.Background(), exp.UserID)))
|
||||
})
|
||||
}
|
||||
|
||||
func must[T any](value T, err error) T {
|
||||
|
Reference in New Issue
Block a user