Skip to content

Commit

Permalink
get rid of testutil.NewServer
Browse files Browse the repository at this point in the history
  • Loading branch information
telyn committed Oct 17, 2017
1 parent 2bc041b commit d96975f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/testutil/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package testutil
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"

"github.com/BytemarkHosting/bytemark-client/lib"
Expand Down Expand Up @@ -75,7 +76,7 @@ func (mh *MuxHandlers) AddMux(ep lib.Endpoint, m Mux) (err error) {
func closeBodyAfter(h http.HandlerFunc) http.HandlerFunc {
return func(wr http.ResponseWriter, r *http.Request) {
h.ServeHTTP(wr, r)
_, _ = r.Body.Close()
_ = r.Body.Close()
}
}

Expand Down Expand Up @@ -123,14 +124,14 @@ func (h Handlers) MakeServers(t *testing.T) (s Servers) {
h.Fill(t)

if h.auth != nil {
s.auth = NewServer(h.auth)
s.auth = httptest.NewServer(h.auth)
} else {
s.auth = NewAuthServer()
}
s.brain = NewServer(h.brain)
s.billing = NewServer(h.billing)
s.api = NewServer(h.api)
s.spp = NewServer(h.spp)
s.brain = httptest.NewServer(h.brain)
s.billing = httptest.NewServer(h.billing)
s.api = httptest.NewServer(h.api)
s.spp = httptest.NewServer(h.spp)

return
}

0 comments on commit d96975f

Please sign in to comment.