You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is kind of hard for new Go programmers to figure out how to write tests.
In the case of authboss, it is not really clear how one could mock authboss for their tests.
If you need help, I can put some time into it. But would be nice to receive some suggestions how you best envision users of authboss to mock authboss for their tests.
The text was updated successfully, but these errors were encountered:
Hi @kulpreet. This library isn't intended for new Go programmers. It's a complicated package because what it does is fairly complicated (abstract the entire HTTP stack to be able to generically provide authentication flows).
As stated elsewhere my ultimate goal with this project is simply to use it for myself. It's open source because it may help others. Personally it's a non-goal to attract a gigantic user base and as such I've left it to other contributors to work on the "making it accessible" part of the project.
As for mocking authboss for testing, it doesn't need mocking. Authboss only deals with the http stack that you define (its interfaces like Renderer, Redirector, etc. etc). So it would be those that you would want to mock. There's also a set of these mock objects already available here: https://godoc.org/github.com/volatiletech/authboss/mocks
It's also important to realize that for a run-of-the-mill endpoint in an API or a HTML web application you're not going to use authboss save for its ability to look up a user in the context using authboss.CurrentUser - and this can be mocked simply by shoving values into the context (See CTXKeyUser https://godoc.org/github.com/volatiletech/authboss#pkg-constants).
It is kind of hard for new Go programmers to figure out how to write tests.
In the case of authboss, it is not really clear how one could mock authboss for their tests.
If you need help, I can put some time into it. But would be nice to receive some suggestions how you best envision users of authboss to mock authboss for their tests.
The text was updated successfully, but these errors were encountered: