Skip to content
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

Mock Client? #148

Closed
dmathieu opened this issue May 3, 2019 · 3 comments
Closed

Mock Client? #148

dmathieu opened this issue May 3, 2019 · 3 comments

Comments

@dmathieu
Copy link

dmathieu commented May 3, 2019

In order to be able to write unit tests for a package using this one as a dependency, it would be nice to be able to mock it.

Making the Client into an interface, with a struct implementing everything it does would allow creating additional structs which implement the interface too, to mock the behavior.

@simar7
Copy link

simar7 commented May 15, 2019

I agree with what @dmathieu has said. Currently anything that's not a method on Client needs to be monkey-patched for unit testing, rather than being able to dependency inject it. This is particularly needed for CreateEvent()

Would this be something on the roadmap for this library?

@stmcallister
Copy link
Contributor

Recent PRs ( #173 and #190) appear to have addressed this. Going to close. Please reopen if this has not been addressed.

@goatherder
Copy link
Contributor

goatherder commented Sep 14, 2020

I don't think this has been fully addressed - there are still some client functions that don't use the client struct - so we cannot override anything. eg: for v2 events - ManageEvent.

I have opened a PR which addresses this: #241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants