Skip to content

Commit 108834b

Browse files
committed
add tenant test for VerifyAndChangeEmailLink
1 parent 57b9ee1 commit 108834b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

auth/tenant_mgt_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,34 @@ func TestTenantEmailSignInLink(t *testing.T) {
569569
}
570570
}
571571

572+
func TestTenantVerifyAndChangeEmail(t *testing.T) {
573+
s := echoServer(testActionLinkResponse, t)
574+
defer s.Close()
575+
576+
client, err := s.Client.TenantManager.AuthForTenant("tenantID")
577+
if err != nil {
578+
t.Fatalf("AuthForTenant() = %v", err)
579+
}
580+
581+
link, err := client.VerifyAndChangeEmailLink(context.Background(), testEmail, testNewEmail)
582+
if err != nil {
583+
t.Fatal(err)
584+
}
585+
if link != testActionLink {
586+
t.Errorf("VerifyAndChangeEmailLink() = %q; want = %q", link, testActionLink)
587+
}
588+
589+
want := map[string]interface{}{
590+
"requestType": "VERIFY_AND_CHANGE_EMAIL",
591+
"email": testEmail,
592+
"returnOobLink": true,
593+
"newEmail": testNewEmail,
594+
}
595+
if err := checkActionLinkRequestWithURL(want, wantEmailActionURL, s); err != nil {
596+
t.Fatalf("VerifyAndChangeEmailLink() %v", err)
597+
}
598+
}
599+
572600
func TestTenantOIDCProviderConfig(t *testing.T) {
573601
s := echoServer([]byte(oidcConfigResponse), t)
574602
defer s.Close()

0 commit comments

Comments
 (0)