MCPcopy Index your code
hub / github.com/coder/coder / TestDBCrypt

Method TestDBCrypt

coderd/database/dbauthz/dbauthz_test.go:4441–4460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4439}
4440
4441func (s *MethodTestSuite) TestDBCrypt() {
4442 s.Run("GetDBCryptKeys", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
4443 dbm.EXPECT().GetDBCryptKeys(gomock.Any()).Return([]database.DBCryptKey{}, nil).AnyTimes()
4444 check.Args().
4445 Asserts(rbac.ResourceSystem, policy.ActionRead).
4446 Returns([]database.DBCryptKey{})
4447 }))
4448 s.Run("InsertDBCryptKey", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
4449 dbm.EXPECT().InsertDBCryptKey(gomock.Any(), database.InsertDBCryptKeyParams{}).Return(nil).AnyTimes()
4450 check.Args(database.InsertDBCryptKeyParams{}).
4451 Asserts(rbac.ResourceSystem, policy.ActionCreate).
4452 Returns()
4453 }))
4454 s.Run("RevokeDBCryptKey", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
4455 dbm.EXPECT().RevokeDBCryptKey(gomock.Any(), "revoke me").Return(nil).AnyTimes()
4456 check.Args("revoke me").
4457 Asserts(rbac.ResourceSystem, policy.ActionUpdate).
4458 Returns()
4459 }))
4460}
4461
4462func (s *MethodTestSuite) TestCryptoKeys() {
4463 s.Run("GetCryptoKeys", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {

Callers

nothing calls this directly

Calls 9

MockedMethod · 0.95
ReturnsMethod · 0.80
AssertsMethod · 0.80
ArgsMethod · 0.80
RunMethod · 0.65
GetDBCryptKeysMethod · 0.65
InsertDBCryptKeyMethod · 0.65
RevokeDBCryptKeyMethod · 0.65
EXPECTMethod · 0.45

Tested by

no test coverage detected