Skip to content

Commit

Permalink
rename and remove unused mock (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 authored Aug 5, 2024
1 parent 3e725df commit 6c541d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions internal/cmdtest/jimmsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (s *JimmCmdSuite) TearDownTest(c *gc.C) {
}
}
// Only delete the DB after closing connections to it.
_, skip_cleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skip_cleanup {
_, skipCleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skipCleanup {
err := jimmtest.DeleteDatabase(s.databaseName)
if err != nil {
c.Logf("failed to delete database (%s): %s", s.databaseName, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/jimmtest/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func dbCleanup(t Tester, gdb *gorm.DB, databaseName string) {
}
}
// Only delete the DB after closing connections to it.
_, skip_cleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skip_cleanup {
_, skipCleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skipCleanup {
err := DeleteDatabase(databaseName)
if err != nil {
t.Logf("failed to delete database (%s): %s", databaseName, err)
Expand Down
9 changes: 1 addition & 8 deletions internal/jimmtest/jimm_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type JIMM struct {
GetCredentialStore_ func() jimmcreds.CredentialStore
GetJimmControllerAccess_ func(ctx context.Context, user *openfga.User, tag names.UserTag) (string, error)
GetUser_ func(ctx context.Context, username string) (*openfga.User, error)
GetOpenFGAUserAndAuthorise_ func(ctx context.Context, email string) (*openfga.User, error)
GetUserCloudAccess_ func(ctx context.Context, user *openfga.User, cloud names.CloudTag) (string, error)
GetUserControllerAccess_ func(ctx context.Context, user *openfga.User, controller names.ControllerTag) (string, error)
GetUserModelAccess_ func(ctx context.Context, user *openfga.User, model names.ModelTag) (string, error)
Expand Down Expand Up @@ -326,13 +325,7 @@ func (j *JIMM) GetUser(ctx context.Context, username string) (*openfga.User, err
if j.GetUser_ == nil {
return nil, errors.E(errors.CodeNotImplemented)
}
return j.GetUser(ctx, username)
}
func (j *JIMM) GetOpenFGAUserAndAuthorise(ctx context.Context, email string) (*openfga.User, error) {
if j.GetOpenFGAUserAndAuthorise_ == nil {
return nil, errors.E(errors.CodeNotImplemented)
}
return j.GetUser(ctx, email)
return j.GetUser_(ctx, username)
}
func (j *JIMM) GetUserCloudAccess(ctx context.Context, user *openfga.User, cloud names.CloudTag) (string, error) {
if j.GetUserCloudAccess_ == nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/jimmtest/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ func (s *JIMMSuite) TearDownTest(c *gc.C) {
c.Logf("failed to close database connections at tear down: %s", err)
}
// Only delete the DB after closing connections to it.
_, skip_cleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skip_cleanup {
_, skipCleanup := os.LookupEnv("NO_DB_CLEANUP")
if !skipCleanup {
err := DeleteDatabase(s.databaseName)
if err != nil {
c.Logf("failed to delete database (%s): %s", s.databaseName, err)
Expand Down

0 comments on commit 6c541d8

Please sign in to comment.