-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c34b295
commit 05e3652
Showing
5 changed files
with
40 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,6 @@ | |
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException; | ||
import com.zimbra.cs.account.AuthToken; | ||
import com.zimbra.cs.service.AuthProvider; | ||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
|
@@ -23,14 +20,16 @@ | |
import com.zimbra.common.soap.AccountConstants; | ||
import com.zimbra.common.soap.Element; | ||
import com.zimbra.cs.account.Account; | ||
import com.zimbra.cs.account.AuthToken; | ||
import com.zimbra.cs.account.MockProvisioning; | ||
import com.zimbra.cs.account.Provisioning; | ||
import com.zimbra.cs.ldap.LdapUtil; | ||
import com.zimbra.cs.mailbox.MailboxTestUtil; | ||
import com.zimbra.cs.service.AuthProvider; | ||
import com.zimbra.cs.service.mail.ServiceTestUtil; | ||
import com.zimbra.soap.JaxbUtil; | ||
import com.zimbra.soap.account.message.ChangePasswordRequest; | ||
import com.zimbra.soap.type.AccountSelector; | ||
import com.zimbra.soap.JaxbUtil; | ||
|
||
public class ChangePasswordTest { | ||
private static final String USERNAME_1 = "[email protected]"; | ||
|
@@ -114,7 +113,7 @@ public void testNeedsAuth() { | |
|
||
Assert.assertFalse("handler.needsAuth()", handler.needsAuth(context)); | ||
} | ||
|
||
@Test | ||
public void testBasicHandlerWithResetPasswordAuthTokenUsageIfMustChangePasswordIsEnabled() throws Exception { | ||
AuthToken authToken = AuthProvider.getAuthToken(account3, AuthToken.Usage.RESET_PASSWORD , AuthToken.TokenType.AUTH); | ||
|
@@ -130,8 +129,12 @@ public void testBasicHandlerWithResetPasswordAuthTokenUsageIfMustChangePasswordI | |
final Element response = handler.handle(JaxbUtil.jaxbToElement(request), context); | ||
Assert.assertNotNull("response", response); | ||
|
||
String at = response.getAttribute(AccountConstants.E_AUTH_TOKEN); | ||
Assert.assertNotNull("authtoken", at); | ||
try { | ||
response.getAttribute(AccountConstants.E_AUTH_TOKEN); | ||
} catch (final ServiceException ex) { | ||
Assert.assertEquals("service exception type", ServiceException.INVALID_REQUEST, ex.getCode()); | ||
Assert.assertTrue("exception message", ex.getMessage().contains("missing required attribute: authToken")); | ||
} | ||
} | ||
|
||
@After | ||
|
@@ -142,4 +145,3 @@ public void tearDown() throws Exception { | |
prov.deleteAccount(account3.getId()); | ||
} | ||
} | ||
|
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