Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions auth/email_action_links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,16 @@ func TestEmailSignInLink(t *testing.T) {

func TestEmailActionLinkNoEmail(t *testing.T) {
client := &Client{}
_, err := client.EmailVerificationLink(context.Background(), "")
if err == nil {

if _, err := client.EmailVerificationLink(context.Background(), ""); err == nil {
t.Errorf("EmailVerificationLink('') = nil; want error")
}

_, err = client.PasswordResetLink(context.Background(), "")
if err == nil {
if _, err := client.PasswordResetLink(context.Background(), ""); err == nil {
t.Errorf("PasswordResetLink('') = nil; want error")
}

_, err = client.EmailSignInLink(context.Background(), "", testActionCodeSettings)
if err == nil {
if _, err := client.EmailSignInLink(context.Background(), "", testActionCodeSettings); err == nil {
t.Errorf("EmailSignInLink('') = nil; want error")
}
}
Expand Down Expand Up @@ -252,8 +250,7 @@ func TestEmailSignInLinkInvalidSettings(t *testing.T) {

func TestEmailSignInLinkNoSettings(t *testing.T) {
client := &Client{}
_, err := client.EmailSignInLink(context.Background(), testEmail, nil)
if err == nil {
if _, err := client.EmailSignInLink(context.Background(), testEmail, nil); err == nil {
t.Errorf("EmailSignInLink(nil) = %v; want = error", err)
}
}
Expand Down
9 changes: 3 additions & 6 deletions auth/user_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,26 +1142,23 @@ func TestSessionCookieWithoutProjectID(t *testing.T) {

func TestSessionCookieWithoutIDToken(t *testing.T) {
client := &Client{}
_, err := client.SessionCookie(context.Background(), "", 10*time.Minute)
if err == nil {
if _, err := client.SessionCookie(context.Background(), "", 10*time.Minute); err == nil {
t.Errorf("CreateSessionCookie('') = nil; want error")
}
}

func TestSessionCookieShortExpiresIn(t *testing.T) {
client := &Client{}
lessThanFiveMins := 5*time.Minute - time.Second
_, err := client.SessionCookie(context.Background(), "idToken", lessThanFiveMins)
if err == nil {
if _, err := client.SessionCookie(context.Background(), "idToken", lessThanFiveMins); err == nil {
t.Errorf("SessionCookie(< 5 mins) = nil; want error")
}
}

func TestSessionCookieLongExpiresIn(t *testing.T) {
client := &Client{}
moreThanTwoWeeks := 14*24*time.Hour + time.Second
_, err := client.SessionCookie(context.Background(), "idToken", moreThanTwoWeeks)
if err == nil {
if _, err := client.SessionCookie(context.Background(), "idToken", moreThanTwoWeeks); err == nil {
t.Errorf("SessionCookie(> 14 days) = nil; want error")
}
}
Expand Down
3 changes: 1 addition & 2 deletions internal/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ func TestInvalidURL(t *testing.T) {
URL: "http://localhost:250/mock.url",
}
client := &HTTPClient{Client: http.DefaultClient}
_, err := client.Do(context.Background(), req)
if err == nil {
if _, err := client.Do(context.Background(), req); err == nil {
t.Errorf("Send() = nil; want error")
}
}
Expand Down
12 changes: 3 additions & 9 deletions messaging/messaging_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,7 @@ func TestSendAllNonMultipartResponse(t *testing.T) {
t.Fatal(err)
}
client.batchEndpoint = ts.URL

_, err = client.SendAll(ctx, testMessages)
if err == nil {
if _, err = client.SendAll(ctx, testMessages); err == nil {
t.Fatal("SendAll() = nil; want = error")
}
}
Expand All @@ -379,9 +377,7 @@ func TestSendAllMalformedContentType(t *testing.T) {
t.Fatal(err)
}
client.batchEndpoint = ts.URL

_, err = client.SendAll(ctx, testMessages)
if err == nil {
if _, err = client.SendAll(ctx, testMessages); err == nil {
t.Fatal("SendAll() = nil; want = error")
}
}
Expand All @@ -405,9 +401,7 @@ func TestSendAllMalformedMultipartResponse(t *testing.T) {
t.Fatal(err)
}
client.batchEndpoint = ts.URL

_, err = client.SendAll(ctx, testMessages)
if err == nil {
if _, err = client.SendAll(ctx, testMessages); err == nil {
t.Fatal("SendAll() = nil; want = error")
}
}
Expand Down