Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update template tests
  • Loading branch information
Emyrk committed Dec 15, 2023
commit 55fbd8ffa09056e8c667f57fb7dba9f005e887f1
33 changes: 33 additions & 0 deletions coderd/database/dbauthz/dbauthz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,30 @@ func (s *MethodTestSuite) TestTemplate() {
ID: t1.ID,
}).Asserts(t1, rbac.ActionCreate)
}))
s.Run("UpdateTemplateAccessControlByID", s.Subtest(func(db database.Store, check *expects) {
t1 := dbgen.Template(s.T(), db, database.Template{})
check.Args(database.UpdateTemplateAccessControlByIDParams{
ID: t1.ID,
}).Asserts(t1, rbac.ActionUpdate)
}))
s.Run("UpdateTemplateScheduleByID", s.Subtest(func(db database.Store, check *expects) {
t1 := dbgen.Template(s.T(), db, database.Template{})
check.Args(database.UpdateTemplateScheduleByIDParams{
ID: t1.ID,
}).Asserts(t1, rbac.ActionUpdate)
}))
s.Run("UpdateTemplateWorkspacesLastUsedAt", s.Subtest(func(db database.Store, check *expects) {
t1 := dbgen.Template(s.T(), db, database.Template{})
check.Args(database.UpdateTemplateWorkspacesLastUsedAtParams{
TemplateID: t1.ID,
}).Asserts(t1, rbac.ActionUpdate)
}))
s.Run("UpdateWorkspacesDormantDeletingAtByTemplateID", s.Subtest(func(db database.Store, check *expects) {
t1 := dbgen.Template(s.T(), db, database.Template{})
check.Args(database.UpdateWorkspacesDormantDeletingAtByTemplateIDParams{
TemplateID: t1.ID,
}).Asserts(t1, rbac.ActionUpdate)
}))
s.Run("UpdateTemplateActiveVersionByID", s.Subtest(func(db database.Store, check *expects) {
t1 := dbgen.Template(s.T(), db, database.Template{
ActiveVersionID: uuid.New(),
Expand Down Expand Up @@ -2097,4 +2121,13 @@ func (s *MethodTestSuite) TestSystemFunctions() {
s.Run("GetTemplateAverageBuildTime", s.Subtest(func(db database.Store, check *expects) {
check.Args(database.GetTemplateAverageBuildTimeParams{}).Asserts(rbac.ResourceSystem, rbac.ActionRead)
}))
s.Run("GetWorkspacesEligibleForTransition", s.Subtest(func(db database.Store, check *expects) {
check.Args(time.Time{}).Asserts()
}))
s.Run("InsertTemplateVersionVariable", s.Subtest(func(db database.Store, check *expects) {
check.Args(database.InsertTemplateVersionVariableParams{}).Asserts(rbac.ResourceSystem, rbac.ActionCreate)
}))
s.Run("UpdateInactiveUsersToDormant", s.Subtest(func(db database.Store, check *expects) {
check.Args(database.UpdateInactiveUsersToDormantParams{}).Asserts(rbac.ResourceSystem, rbac.ActionCreate)
}))
}