MCPcopy Create free account
hub / github.com/coder/coder / TestBoundaryLogs

Method TestBoundaryLogs

coderd/database/dbauthz/dbauthz_test.go:445–473  ·  view source on GitHub ↗

TODO (PR #24810): These RBAC assertions use placeholder resource types. They will be updated when the dedicated boundary_log resource type is added.

()

Source from the content-addressed store, hash-verified

443// TODO (PR #24810): These RBAC assertions use placeholder resource types.
444// They will be updated when the dedicated boundary_log resource type is added.
445func (s *MethodTestSuite) TestBoundaryLogs() {
446 s.Run("InsertBoundarySession", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
447 arg := database.InsertBoundarySessionParams{}
448 dbm.EXPECT().InsertBoundarySession(gomock.Any(), arg).Return(database.BoundarySession{}, nil).AnyTimes()
449 check.Args(arg).Asserts(rbac.ResourceAuditLog, policy.ActionCreate)
450 }))
451 s.Run("GetBoundarySessionByID", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
452 dbm.EXPECT().GetBoundarySessionByID(gomock.Any(), uuid.Nil).Return(database.BoundarySession{}, nil).AnyTimes()
453 check.Args(uuid.Nil).Asserts(rbac.ResourceAuditLog, policy.ActionRead)
454 }))
455 s.Run("InsertBoundaryLog", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
456 arg := database.InsertBoundaryLogParams{}
457 dbm.EXPECT().InsertBoundaryLog(gomock.Any(), arg).Return(database.BoundaryLog{}, nil).AnyTimes()
458 check.Args(arg).Asserts(rbac.ResourceAuditLog, policy.ActionCreate)
459 }))
460 s.Run("GetBoundaryLogByID", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
461 dbm.EXPECT().GetBoundaryLogByID(gomock.Any(), uuid.Nil).Return(database.BoundaryLog{}, nil).AnyTimes()
462 check.Args(uuid.Nil).Asserts(rbac.ResourceAuditLog, policy.ActionRead)
463 }))
464 s.Run("ListBoundaryLogsBySessionID", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
465 arg := database.ListBoundaryLogsBySessionIDParams{}
466 dbm.EXPECT().ListBoundaryLogsBySessionID(gomock.Any(), arg).Return([]database.BoundaryLog{}, nil).AnyTimes()
467 check.Args(arg).Asserts(rbac.ResourceAuditLog, policy.ActionRead)
468 }))
469 s.Run("DeleteOldBoundaryLogs", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
470 dbm.EXPECT().DeleteOldBoundaryLogs(gomock.Any(), database.DeleteOldBoundaryLogsParams{}).Return(int64(0), nil).AnyTimes()
471 check.Args(database.DeleteOldBoundaryLogsParams{}).Asserts(rbac.ResourceSystem, policy.ActionDelete)
472 }))
473}
474
475func (s *MethodTestSuite) TestConnectionLogs() {
476 s.Run("BatchUpsertConnectionLogs", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {

Callers

nothing calls this directly

Calls 11

MockedMethod · 0.95
AssertsMethod · 0.80
ArgsMethod · 0.80
RunMethod · 0.65
InsertBoundarySessionMethod · 0.65
InsertBoundaryLogMethod · 0.65
GetBoundaryLogByIDMethod · 0.65
DeleteOldBoundaryLogsMethod · 0.65
EXPECTMethod · 0.45

Tested by

no test coverage detected