Skip to content

Commit 1a45270

Browse files
committed
test fix
1 parent 94c9e4b commit 1a45270

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/user-authenticators/oauth2/src/test/java/org/apache/cloudstack/oauth2/api/command/VerifyOAuthCodeAndGetUserCmdTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.cloudstack.oauth2.api.command;
2121

22+
import static org.mockito.ArgumentMatchers.any;
23+
import static org.mockito.ArgumentMatchers.eq;
2224
import static org.mockito.Mockito.mock;
2325
import static org.mockito.Mockito.when;
2426

@@ -71,7 +73,8 @@ public void testAuthenticate() {
7173
params.put("secretcode", secretcodeArray);
7274
params.put("provider", providerArray);
7375

74-
when(oauth2mgr.verifyCodeAndFetchEmail("secretcode", "provider", null)).thenReturn("test@example.com");
76+
when(oauth2mgr.resolveDomainId(any())).thenReturn(null);
77+
when(oauth2mgr.verifyCodeAndFetchEmail(eq("secretcode"), eq("provider"), any())).thenReturn("test@example.com");
7578

7679
String response = cmd.authenticate("command", params, session, remoteAddress, responseType, auditTrailSb, req, resp);
7780

@@ -89,7 +92,8 @@ public void testAuthenticateWithInvalidCode() throws Exception {
8992
params.put("secretcode", secretcodeArray);
9093
params.put("provider", providerArray);
9194

92-
when(oauth2mgr.verifyCodeAndFetchEmail("invalidcode", "provider", null)).thenReturn(null);
95+
when(oauth2mgr.resolveDomainId(any())).thenReturn(null);
96+
when(oauth2mgr.verifyCodeAndFetchEmail(eq("invalidcode"), eq("provider"), any())).thenReturn(null);
9397

9498
cmd.authenticate("command", params, session, remoteAddress, responseType, auditTrailSb, req, resp);
9599
}

0 commit comments

Comments
 (0)