use of com.zimbra.cs.client.soap.LmcSearchRequest in project zm-mailbox by Zimbra.
the class TestAuthentication method testAccessInactiveAccount.
/**
* Attempts to access a deleted account and confirms that the attempt
* fails with an auth error.
*/
public void testAccessInactiveAccount() throws Exception {
// Log in and check the inbox
LmcSession session = TestUtil.getSoapSession(USER_NAME);
LmcSearchRequest req = new LmcSearchRequest();
req.setQuery("in:inbox");
req.setSession(session);
req.invoke(TestUtil.getSoapUrl());
// Deactivate the account
Account account = getAccount();
mProv.modifyAccountStatus(account, Provisioning.ACCOUNT_STATUS_MAINTENANCE);
// Submit another request and make sure it fails with an auth error
try {
req.invoke(TestUtil.getSoapUrl());
} catch (SoapFaultException ex) {
String substring = "auth credentials have expired";
String msg = String.format("Error message '%s' does not contain '%s'", ex.getMessage(), substring);
assertTrue(msg, ex.getMessage().contains(substring));
}
}
use of com.zimbra.cs.client.soap.LmcSearchRequest in project zm-mailbox by Zimbra.
the class TestAuthentication method testAccessDeletedAccount.
/**
* Attempts to access a deleted account and confirms that the attempt
* fails with an auth error.
*/
public void testAccessDeletedAccount() throws Exception {
// Log in and check the inbox
LmcSession session = TestUtil.getSoapSession(USER_NAME);
LmcSearchRequest req = new LmcSearchRequest();
req.setQuery("in:inbox");
req.setSession(session);
req.invoke(TestUtil.getSoapUrl());
// Delete the account
Account account = getAccount();
assertNotNull("Account does not exist", account);
mProv.deleteAccount(account.getId());
// Submit another request and make sure it fails with an auth error
try {
req.invoke(TestUtil.getSoapUrl());
} catch (SoapFaultException ex) {
assertTrue("Unexpected error: " + ex.getMessage(), ex.getMessage().indexOf("auth credentials have expired") >= 0);
}
}
Aggregations