-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add mockery test case to token reconciler #446
Conversation
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
/hold |
@vjayaramrh |
@@ -39,6 +39,7 @@ type GiteaClient interface { | |||
GetRepo(userName string, repoCRName string) (*gitea.Repository, *gitea.Response, error) | |||
CreateRepo(createRepoOption gitea.CreateRepoOption) (*gitea.Repository, *gitea.Response, error) | |||
EditRepo(userName string, repoCRName string, editRepoOption gitea.EditRepoOption) (*gitea.Repository, *gitea.Response, error) | |||
DeleteAccessToken(value interface{}) (*gitea.Response, 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.
Curious as to why is this an interface{}
?
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 guess to allow for a broader identifier.
https://gitea.com/gitea/go-sdk/src/branch/main/gitea/user_app.go#L118
giteaClient: tt.fields.giteaClient, | ||
finalizer: tt.fields.finalizer, | ||
} | ||
// The below block being setup and processing of mocks before invoking the function to be tested |
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 like the block of code from L85 to L91 can be captured in a function to be reused by every test case that uses mockery, right? What do you think?
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.
It looks like its generic/common to all yes. I pulled it directly from your other example.
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.
Maybe we can leave it here for now and maybe refactor later. I'd like to get this PR merged so that I can refactor the Repository unit tests to use Mockery.
/retest |
/retest |
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
/ok-to-test |
/unhold |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: henderiw The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add mock nephio gitea client. Add example test case fro deketeToken function. Anti pattern arises in relation to the gitea client wrapper as it's also being used by the repo reconciler. --------- Signed-off-by: efiacor <fiachra.corcoran@est.tech> Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com>
Add mock nephio gitea client.
Add example test case fro deketeToken function.
Anti pattern arises in relation to the gitea client wrapper as it's also being used by the repo reconciler.