I've read the documentation at https://golang.org/doc/code.html on testing,
but I'm wondering how you would do something like mock a HTTP or DB
connection.
I'm sure there is a way to do this without creating custom mock objects for
everything, but I'm not seeing any information on the topic.
For example. I have certain pathways that should be only available to
logged in users. Logged in would mean that we have attached a "user"
object to the session store for that request.
I check for a user object at the top of every protected route and I return
an http error code if there isn't once..
I'd really rather not write my own mocks for request & response, and I
can't seem to find a way to "fake one" by directly invoking it such as.
req := http.Request{}
Ideas?
Thanks!
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.