Skip to content

Commit a3fd795

Browse files
fix dbmem tests
1 parent 13d7e1e commit a3fd795

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ func (s *MethodTestSuite) TestUser() {
18451845
check.Args(database.DeleteCustomRoleParams{
18461846
Name: customRole.Name,
18471847
}).Asserts(
1848-
// fails immediately, missing organization id
1848+
// fails immediately, missing organization id
18491849
).Errors(dbauthz.NotAuthorizedError{Err: xerrors.New("custom roles must belong to an organization")})
18501850
}))
18511851
s.Run("Blank/UpdateCustomRole", s.Subtest(func(db database.Store, check *expects) {
@@ -1876,7 +1876,7 @@ func (s *MethodTestSuite) TestUser() {
18761876
codersdk.ResourceWorkspace: {codersdk.ActionRead},
18771877
}), convertSDKPerm),
18781878
}).Asserts(
1879-
// fails immediately, missing organization id
1879+
// fails immediately, missing organization id
18801880
).Errors(dbauthz.NotAuthorizedError{Err: xerrors.New("custom roles must belong to an organization")})
18811881
}))
18821882
s.Run("OrgPermissions/UpdateCustomRole", s.Subtest(func(db database.Store, check *expects) {
@@ -1929,7 +1929,7 @@ func (s *MethodTestSuite) TestUser() {
19291929
codersdk.ResourceWorkspace: {codersdk.ActionRead},
19301930
}), convertSDKPerm),
19311931
}).Asserts(
1932-
// fails immediately, missing organization id
1932+
// fails immediately, missing organization id
19331933
).Errors(dbauthz.NotAuthorizedError{Err: xerrors.New("custom roles must belong to an organization")})
19341934
}))
19351935
s.Run("OrgPermissions/InsertCustomRole", s.Subtest(func(db database.Store, check *expects) {
@@ -4262,13 +4262,13 @@ func (s *MethodTestSuite) TestSystemFunctions() {
42624262
StorageMethod: database.ProvisionerStorageMethodFile,
42634263
Type: database.ProvisionerJobTypeWorkspaceBuild,
42644264
Input: json.RawMessage("{}"),
4265-
}).Asserts( /* rbac.ResourceProvisionerJobs, policy.ActionCreate */ )
4265+
}).Asserts( /* rbac.ResourceProvisionerJobs, policy.ActionCreate */)
42664266
}))
42674267
s.Run("InsertProvisionerJobLogs", s.Subtest(func(db database.Store, check *expects) {
42684268
j := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
42694269
check.Args(database.InsertProvisionerJobLogsParams{
42704270
JobID: j.ID,
4271-
}).Asserts( /* rbac.ResourceProvisionerJobs, policy.ActionUpdate */ )
4271+
}).Asserts( /* rbac.ResourceProvisionerJobs, policy.ActionUpdate */)
42724272
}))
42734273
s.Run("InsertProvisionerJobTimings", s.Subtest(func(db database.Store, check *expects) {
42744274
j := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
@@ -5725,6 +5725,8 @@ func (s *MethodTestSuite) TestUserSecrets() {
57255725
arg := database.InsertUserSecretParams{
57265726
UserID: user.ID,
57275727
}
5728-
check.Args(arg).Asserts(rbac.ResourceUserSecret.WithOwner(arg.UserID.String()), policy.ActionCreate)
5728+
check.Args(arg).
5729+
Asserts(rbac.ResourceUserSecret.WithOwner(arg.UserID.String()), policy.ActionCreate).
5730+
ErrorsWithInMemDB(dbmem.ErrUnimplemented)
57295731
}))
57305732
}

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9716,7 +9716,7 @@ func (q *FakeQuerier) InsertUserSecret(ctx context.Context, arg database.InsertU
97169716
return database.UserSecret{}, err
97179717
}
97189718

9719-
panic("not implemented")
9719+
return database.UserSecret{}, ErrUnimplemented
97209720
}
97219721

97229722
func (q *FakeQuerier) InsertVolumeResourceMonitor(_ context.Context, arg database.InsertVolumeResourceMonitorParams) (database.WorkspaceAgentVolumeResourceMonitor, error) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy