Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: server/auth/signing/context_test.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Update tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: server/auth/signing/context_test.go
diff --git a/server/auth/signing/context_test.go b/server/auth/signing/context_test.go
index 4a49d16f4d3a738df2cefd762c018b04bb6f72b6..667520014d04995fc54ac572ce8437f76238af1d 100644
--- a/server/auth/signing/context_test.go
+++ b/server/auth/signing/context_test.go
@@ -6,14 +6,12 @@ package signing
import (
"errors"
- "net/http"
"net/http/httptest"
"testing"
- "github.com/julienschmidt/httprouter"
"golang.org/x/net/context"
- "github.com/luci/luci-go/server/middleware"
+ "github.com/luci/luci-go/server/router"
. "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
@@ -34,14 +32,13 @@ func TestContext(t *testing.T) {
}
func TestHandlers(t *testing.T) {
-
call := func(s Signer) (*PublicCertificates, error) {
- r := httprouter.New()
- InstallHandlers(r, func(h middleware.Handler) httprouter.Handle {
- return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
- ctx := SetSigner(context.Background(), s)
- h(ctx, w, r, p)
- }
+ r := router.New()
+ InstallHandlers(r, router.MiddlewareChain{
+ func(c *router.Context, next router.Handler) {
+ c.Context = SetSigner(context.Background(), s)
+ next(c)
+ },
})
ts := httptest.NewServer(r)
return FetchCertificates(context.Background(), ts.URL+"/auth/api/v1/server/certificates")

Powered by Google App Engine
This is Rietveld 408576698