FAQ
I have a web app I would like to do regression testing on at build time.
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.

Search Discussions

  • Tamás Gulácsi at Feb 16, 2015 at 5:28 am
    Have you seen net/http/http test ?

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 16, '15 at 4:04a
activeFeb 16, '15 at 5:28a
posts2
users2
websitegolang.org

2 users in discussion

Tamás Gulácsi: 1 post Maxpowers477: 1 post

People

Translate

site design / logo © 2022 Grokbase