OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "testing" | 8 "testing" |
9 | 9 |
10 userS "github.com/luci/gae/service/user" | 10 userS "github.com/luci/gae/service/user" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 usr, err := user.CurrentOAuth("scope") | 83 usr, err := user.CurrentOAuth("scope") |
84 So(usr, ShouldBeNil) | 84 So(usr, ShouldBeNil) |
85 So(err, ShouldBeNil) | 85 So(err, ShouldBeNil) |
86 }) | 86 }) |
87 }) | 87 }) |
88 | 88 |
89 Convey("panics on bad email", func() { | 89 Convey("panics on bad email", func() { |
90 So(func() { | 90 So(func() { |
91 user.Testable().Login("bademail", "", false) | 91 user.Testable().Login("bademail", "", false) |
92 » » » }, ShouldPanicLike, `"bademail" doesn't seem to be a val
id email`) | 92 » » » }, ShouldPanicLike, `mail: missing phrase`) |
93 | |
94 » » » So(func() { | |
95 » » » » user.Testable().Login("too@many@ats.com", "", fa
lse) | |
96 » » » }, ShouldPanicLike, `"too@many@ats.com" doesn't seem to
be a valid email`) | |
97 }) | 93 }) |
98 | 94 |
99 Convey("fake URLs", func() { | 95 Convey("fake URLs", func() { |
100 url, err := user.LoginURL("https://funky.example.com") | 96 url, err := user.LoginURL("https://funky.example.com") |
101 So(err, ShouldBeNil) | 97 So(err, ShouldBeNil) |
102 So(url, ShouldEqual, "https://fakeapp.example.com/_ah/lo
gin?redirect=https%3A%2F%2Ffunky.example.com") | 98 So(url, ShouldEqual, "https://fakeapp.example.com/_ah/lo
gin?redirect=https%3A%2F%2Ffunky.example.com") |
103 | 99 |
104 url, err = user.LogoutURL("https://funky.example.com") | 100 url, err = user.LogoutURL("https://funky.example.com") |
105 So(err, ShouldBeNil) | 101 So(err, ShouldBeNil) |
106 So(url, ShouldEqual, "https://fakeapp.example.com/_ah/lo
gout?redirect=https%3A%2F%2Ffunky.example.com") | 102 So(url, ShouldEqual, "https://fakeapp.example.com/_ah/lo
gout?redirect=https%3A%2F%2Ffunky.example.com") |
107 }) | 103 }) |
108 | 104 |
109 Convey("Some stuff is deprecated", func() { | 105 Convey("Some stuff is deprecated", func() { |
110 url, err := user.LoginURLFederated("https://something",
"something") | 106 url, err := user.LoginURLFederated("https://something",
"something") |
111 So(err, ShouldErrLike, "LoginURLFederated is deprecated"
) | 107 So(err, ShouldErrLike, "LoginURLFederated is deprecated"
) |
112 So(url, ShouldEqual, "") | 108 So(url, ShouldEqual, "") |
113 | 109 |
114 key, err := user.OAuthConsumerKey() | 110 key, err := user.OAuthConsumerKey() |
115 So(err, ShouldErrLike, "OAuthConsumerKey is deprecated") | 111 So(err, ShouldErrLike, "OAuthConsumerKey is deprecated") |
116 So(key, ShouldEqual, "") | 112 So(key, ShouldEqual, "") |
117 }) | 113 }) |
118 | 114 |
119 }) | 115 }) |
120 } | 116 } |
OLD | NEW |