-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from danieliu456/kc24
upgrade to Kc24
- Loading branch information
Showing
5 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import org.keycloak.models.RealmModel; | ||
import org.keycloak.models.UserModel; | ||
import org.keycloak.sessions.AuthenticationSessionModel; | ||
import org.keycloak.userprofile.UserProfileProvider; | ||
import org.mockito.ArgumentCaptor; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
@@ -38,6 +39,8 @@ class VerifyEmailByCodeTest { | |
@Mock | ||
private UserModel user; | ||
@Mock | ||
private UserProfileProvider provider; | ||
@Mock | ||
private KeycloakSession session; | ||
@Mock | ||
private EventBuilder event; | ||
|
@@ -167,7 +170,7 @@ public void shouldGenerateCodeWithSixDigits() { | |
private void mockChallenge() { | ||
when(requiredActionContext.getUser()).thenReturn(user); | ||
when(user.getEmail()).thenReturn("[email protected]"); | ||
|
||
when(session.getProvider(UserProfileProvider.class)).thenReturn(provider); | ||
when(requiredActionContext.getSession()).thenReturn(session); | ||
|
||
when(requiredActionContext.getEvent()).thenReturn(event); | ||
|
@@ -235,6 +238,8 @@ public void shouldChallengeOnProcessActionWhenCodeIsNull() throws EmailException | |
public void shouldChallengeWithErrorOnProcessActionWhenCodeIsNotValid() { | ||
initAction(); | ||
when(requiredActionContext.getUser()).thenReturn(user); | ||
when(session.getProvider(UserProfileProvider.class)).thenReturn(provider); | ||
when(requiredActionContext.getSession()).thenReturn(session); | ||
when(user.getEmail()).thenReturn("[email protected]"); | ||
|
||
when(requiredActionContext.getEvent()).thenReturn(event); | ||
|
@@ -243,6 +248,7 @@ public void shouldChallengeWithErrorOnProcessActionWhenCodeIsNotValid() { | |
when(event.detail(Details.EMAIL, user.getEmail())).thenReturn(event); | ||
|
||
when(requiredActionContext.getAuthenticationSession()).thenReturn(authSession); | ||
|
||
when(authSession.getAuthNote(VerifyEmailByCode.VERIFY_EMAIL_CODE)).thenReturn("code is valid"); | ||
|
||
HttpRequest request = mock(HttpRequest.class); | ||
|