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
add dbcrypt methods
  • Loading branch information
johnstcn authored and Emyrk committed Dec 15, 2023
commit 193d3b3c7027c2a2148bc17064449c186c253bd9
22 changes: 22 additions & 0 deletions coderd/database/dbauthz/dbauthz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,28 @@ func (s *MethodTestSuite) TestTailnetFunctions() {
}))
}

func (s *MethodTestSuite) TestDBCrypt() {
s.Run("GetDBCryptKeys", s.Subtest(func(db database.Store, check *expects) {
check.Args().
Asserts(rbac.ResourceSystem, rbac.ActionRead).
Returns([]database.DBCryptKey{})
}))
s.Run("InsertDBCryptKey", s.Subtest(func(db database.Store, check *expects) {
check.Args(database.InsertDBCryptKeyParams{}).
Asserts(rbac.ResourceSystem, rbac.ActionCreate).
Returns()
}))
s.Run("RevokeDBCryptKey", s.Subtest(func(db database.Store, check *expects) {
err := db.InsertDBCryptKey(context.Background(), database.InsertDBCryptKeyParams{
ActiveKeyDigest: "revoke me",
})
s.NoError(err)
check.Args("revoke me").
Asserts(rbac.ResourceSystem, rbac.ActionUpdate).
Returns()
}))
}

func (s *MethodTestSuite) TestSystemFunctions() {
s.Run("UpdateUserLinkedID", s.Subtest(func(db database.Store, check *expects) {
u := dbgen.User(s.T(), db, database.User{})
Expand Down