use of com.zimbra.cs.service.account.ResetPassword in project zm-mailbox by Zimbra.
the class TestResetPassword method testResetPassword.
@Test
public void testResetPassword() throws Exception {
Provisioning prov = Provisioning.getInstance();
Account acct1 = prov.getAccount(USER_NAME);
acct1.setFeatureResetPasswordStatus(FeatureResetPasswordStatus.enabled);
ResetPassword resetPassword = new TestResetPassword();
Map<String, Object> ctxt = ServiceTestUtil.getRequestContext(acct1);
ResetPasswordRequest resetReq = new ResetPasswordRequest();
resetReq.setPassword(NEW_PASSWORD);
Element request = JaxbUtil.jaxbToElement(resetReq);
try {
resetPassword.handle(request, ctxt);
} catch (ServiceException se) {
Assert.fail("This should not happen");
}
}
use of com.zimbra.cs.service.account.ResetPassword in project zm-mailbox by Zimbra.
the class TestResetPassword method testResetPassword_FeatureDisabled.
@Test
public void testResetPassword_FeatureDisabled() throws Exception {
Provisioning prov = Provisioning.getInstance();
Account acct1 = prov.getAccount(USER_NAME);
acct1.setFeatureResetPasswordStatus(FeatureResetPasswordStatus.enabled);
ResetPassword resetPassword = new TestResetPassword();
Map<String, Object> ctxt = ServiceTestUtil.getRequestContext(acct1);
ResetPasswordRequest resetReq = new ResetPasswordRequest();
resetReq.setPassword(NEW_PASSWORD);
Element request = JaxbUtil.jaxbToElement(resetReq);
try {
resetPassword.handle(request, ctxt);
} catch (ServiceException se) {
Assert.assertEquals("permission denied: Reset password feature is disabled", se.getMessage());
}
}
Aggregations