-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor mocks packages #368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! just a couple minor comments.
conjurSecrets := make(map[string][]byte) | ||
|
||
if !CanExecuteConjurVar { | ||
if !c.CanExecute { | ||
return nil, errors.New("custom error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this error message is existing, but could we change the error message to something better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My take is that the user of the mock should be able to specify their own errors, instead of specifying boolean values like CanExecute
. I didn't want the scope of my changes to keep growing so I left TODOs for that.
249246c
to
2c8e391
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
Thanks for taking care of this!
|
||
func NewConjurMockClient() ConjurMockClient { | ||
database := map[string]string{ | ||
"conjur_variable1": "conjur_secret1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this uses hardcoded, "canned" database entries. Should we add a TODO to make the database entries configurable for a new mock client object? (e.g. by either adding a map[]string
argument to NewConjurMockClient
, or create an AddSecret
method for the object)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an AddSecret() in 363
eq := reflect.DeepEqual(variableIDsActual, variableIDsExpected) | ||
So(eq, ShouldEqual, true) | ||
|
||
So(variableIDsActual, ShouldResemble, variableIDsExpected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T.I.L. Convey has a ShouldResemble
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Moves Conjur mocks to dedicated directory. Binds mocks to struct instances instead of using global variables
2c8e391
to
35a04eb
Compare
Code Climate has analyzed commit 35a04eb and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 94.2% (0.0% change). View more on Code Climate. |
What does this PR do?
Moves Conjur mocks to dedicated directory. Binds mocks to struct instances instead of using global variables
What ticket does this PR close?
Resolves -
Checklists
Change log
Test coverage
Documentation
README
s) were updated in this PR, and/or there is a follow-on issue to update docs, or