8000 chore: enforcement of dbauthz tests was broken by Emyrk · Pull Request #11218 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

chore: enforcement of dbauthz tests was broken #11218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 15, 2023
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
0