use of org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator in project identity-outbound-auth-sms-otp by wso2-extensions.
the class SMSOTPAuthenticatorTest method testGetURL.
@Test
public void testGetURL() throws Exception {
SMSOTPAuthenticator smsotp = PowerMockito.spy(smsotpAuthenticator);
Assert.assertEquals(Whitebox.invokeMethod(smsotp, "getURL", SMSOTPConstants.LOGIN_PAGE, null), "authenticationendpoint/login.do?authenticators=SMSOTP");
}
use of org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator in project identity-outbound-auth-sms-otp by wso2-extensions.
the class SMSOTPAuthenticatorTest method testGetURLwithQueryParams.
@Test
public void testGetURLwithQueryParams() throws Exception {
SMSOTPAuthenticator smsotp = PowerMockito.spy(smsotpAuthenticator);
Assert.assertEquals(Whitebox.invokeMethod(smsotp, "getURL", SMSOTPConstants.LOGIN_PAGE, "n=John&n=Susan"), "authenticationendpoint/login.do?n=John&n=Susan&authenticators=SMSOTP");
}
use of org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator in project identity-outbound-auth-sms-otp by wso2-extensions.
the class SMSOTPAuthenticatorTest method testRedirectToMobileNumberReqPage.
@Test
public void testRedirectToMobileNumberReqPage() throws Exception {
mockStatic(SMSOTPUtils.class);
AuthenticationContext authenticationContext = new AuthenticationContext();
when(SMSOTPUtils.isEnableMobileNoUpdate(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME)).thenReturn(true);
when(SMSOTPUtils.getMobileNumberRequestPage(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME)).thenReturn("/smsotpauthenticationendpoint/mobile.jsp");
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
Whitebox.invokeMethod(smsotpAuthenticator, "redirectToMobileNoReqPage", httpServletResponse, authenticationContext, null);
verify(httpServletResponse).sendRedirect(captor.capture());
Assert.assertTrue(captor.getValue().contains(SMSOTPConstants.AUTHENTICATOR_NAME));
}
use of org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator in project identity-outbound-auth-sms-otp by wso2-extensions.
the class SMSOTPAuthenticatorTest method testRedirectToErrorPage.
@Test
public void testRedirectToErrorPage() throws Exception {
mockStatic(SMSOTPUtils.class);
AuthenticationContext authenticationContext = new AuthenticationContext();
when(SMSOTPUtils.getErrorPageFromXMLFile(authenticationContext, SMSOTPConstants.AUTHENTICATOR_NAME)).thenReturn("/smsotpauthenticationendpoint/smsotpError.jsp");
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
Whitebox.invokeMethod(smsotpAuthenticator, "redirectToErrorPage", httpServletResponse, authenticationContext, null, null);
verify(httpServletResponse).sendRedirect(captor.capture());
Assert.assertTrue(captor.getValue().contains(SMSOTPConstants.AUTHENTICATOR_NAME));
}
use of org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator in project identity-outbound-auth-sms-otp by wso2-extensions.
the class SMSOTPAuthenticatorTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
smsotpAuthenticator = new SMSOTPAuthenticator();
initMocks(this);
}
Aggregations