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

Unified Diff: server/auth/openid/method_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/openid/method_test.go
diff --git a/server/auth/openid/method_test.go b/server/auth/openid/method_test.go
index 14008c4722ea373ebb2e992ab9d05cb2399fa3ac..79db29903fbbc341524323d6f98fd9cf55196117 100644
--- a/server/auth/openid/method_test.go
+++ b/server/auth/openid/method_test.go
@@ -15,6 +15,7 @@ import (
"github.com/luci/luci-go/common/clock/testclock"
"github.com/luci/luci-go/server/auth"
"github.com/luci/luci-go/server/auth/authtest"
+ "github.com/luci/luci-go/server/router"
"github.com/luci/luci-go/server/secrets/testsecrets"
"github.com/luci/luci-go/server/settings"
"golang.org/x/net/context"
@@ -92,7 +93,7 @@ func TestFullFlow(t *testing.T) {
req, err := http.NewRequest("GET", "http://fake"+loginURL, nil)
So(err, ShouldBeNil)
rec := httptest.NewRecorder()
- method.loginHandler(ctx, rec, req, nil)
+ method.loginHandler(&router.Context{Context: ctx, Writer: rec, Request: req, Params: nil})
// It asks us to visit authorizarion endpoint.
So(rec.Code, ShouldEqual, http.StatusFound)
@@ -122,7 +123,7 @@ func TestFullFlow(t *testing.T) {
req, err = http.NewRequest("GET", "http://fake/redirect?"+callbackParams.Encode(), nil)
So(err, ShouldBeNil)
rec = httptest.NewRecorder()
- method.callbackHandler(ctx, rec, req, nil)
+ method.callbackHandler(&router.Context{Context: ctx, Writer: rec, Request: req, Params: nil})
// We should be redirected to the login page, with session cookie set.
expectedCookie := "oid_session=AXsiX2kiOiIxNDQyNTQwMDAwMDAwIiwic2lkIjoi" +
@@ -153,7 +154,7 @@ func TestFullFlow(t *testing.T) {
So(err, ShouldBeNil)
req.Header.Add("Cookie", expectedCookie)
rec = httptest.NewRecorder()
- method.logoutHandler(ctx, rec, req, nil)
+ method.logoutHandler(&router.Context{Context: ctx, Writer: rec, Request: req, Params: nil})
// Should be redirected to destination with the cookie killed.
So(rec.Code, ShouldEqual, http.StatusFound)
@@ -182,7 +183,7 @@ func TestCallbackHandleEdgeCases(t *testing.T) {
c.So(err, ShouldBeNil)
req.Host = "fake.com"
rec := httptest.NewRecorder()
- method.callbackHandler(ctx, rec, req, nil)
+ method.callbackHandler(&router.Context{Context: ctx, Writer: rec, Request: req, Params: nil})
return rec
}

Powered by Google App Engine
This is Rietveld 408576698