Skip to content

Refactor MockUserLookup and MockUsersLookup into a single struct #439

@EthanHeilman

Description

@EthanHeilman

We duplicate MockUserLookup in a number of test functions. We should unify these into a single struct in a test helper package.

// Duplicates code from multipolicyloader_test.go
type MockUserLookup struct {
	// User is returned on any call to Lookup() if Error is nil
	User *user.User
	// Error is returned on any call to Lookup() if non-nil
	Error error
}

We will likely want to support setting more than one user

// MockUsersLookup implements commands.UserLookup for testing
type MockUsersLookup struct {
	Users map[string]*user.User
	Error error
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions