Skip to content

Commit 193d3b3

Browse files
johnstcnEmyrk
authored andcommitted
add dbcrypt methods
1 parent f38be5d commit 193d3b3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,28 @@ func (s *MethodTestSuite) TestTailnetFunctions() {
15571557
}))
15581558
}
15591559

1560+
func (s *MethodTestSuite) TestDBCrypt() {
1561+
s.Run("GetDBCryptKeys", s.Subtest(func(db database.Store, check *expects) {
1562+
check.Args().
1563+
Asserts(rbac.ResourceSystem, rbac.ActionRead).
1564+
Returns([]database.DBCryptKey{})
1565+
}))
1566+
s.Run("InsertDBCryptKey", s.Subtest(func(db database.Store, check *expects) {
1567+
check.Args(database.InsertDBCryptKeyParams{}).
1568+
Asserts(rbac.ResourceSystem, rbac.ActionCreate).
1569+
Returns()
1570+
}))
1571+
s.Run("RevokeDBCryptKey", s.Subtest(func(db database.Store, check *expects) {
1572+
err := db.InsertDBCryptKey(context.Background(), database.InsertDBCryptKeyParams{
1573+
ActiveKeyDigest: "revoke me",
1574+
})
1575+
s.NoError(err)
1576+
check.Args("revoke me").
1577+
Asserts(rbac.ResourceSystem, rbac.ActionUpdate).
1578+
Returns()
1579+
}))
1580+
}
1581+
15601582
func (s *MethodTestSuite) TestSystemFunctions() {
15611583
s.Run("UpdateUserLinkedID", s.Subtest(func(db database.Store, check *expects) {
15621584
u := dbgen.User(s.T(), db, database.User{})

0 commit comments

Comments
 (0)