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

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..d6cda774b5b84e545458e4df1fef10ebcd817c66 100644
--- a/server/auth/signing/context_test.go
+++ b/server/auth/signing/context_test.go
@@ -6,16 +6,13 @@ 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/common/testing/assertions"
+ "github.com/luci/luci-go/server/router"
. "github.com/smartystreets/goconvey/convey"
)
@@ -36,12 +33,9 @@ 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.Handler{
+ func(c *router.Context) { c.Context = SetSigner(context.Background(), s) },
})
ts := httptest.NewServer(r)
return FetchCertificates(context.Background(), ts.URL+"/auth/api/v1/server/certificates")

Powered by Google App Engine
This is Rietveld 408576698