use of com.microsoft.identity.common.internal.cache.AccountDeletionRecord in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalCppOAuth2TokenCacheTest method removeAccountWithHomeAccountIdTest.
@Test
public void removeAccountWithHomeAccountIdTest() throws ClientException {
// Get the generated account
final AccountRecord generatedAccount = mTestBundle.mGeneratedAccount;
// Save it to the cache
mCppCache.saveAccountRecord(generatedAccount);
mCppCache.saveCredentials(null, mTestBundle.mGeneratedRefreshToken);
// Call remove
final AccountDeletionRecord deletionRecord = mCppCache.removeAccount(generatedAccount.getHomeAccountId(), "", "");
// Check the receipt
Assert.assertEquals(generatedAccount, deletionRecord.get(0));
// Try to restore it
final AccountRecord restoredAccount = mCppCache.getAccount(generatedAccount.getHomeAccountId(), generatedAccount.getEnvironment(), generatedAccount.getRealm());
// Make sure it doesn't exist....
Assert.assertNull(restoredAccount);
}
use of com.microsoft.identity.common.internal.cache.AccountDeletionRecord in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalCppOAuth2TokenCacheTest method removeNonexistentAccountTest.
@Test
public void removeNonexistentAccountTest() throws ClientException {
final AccountRecord generatedAccount = mTestBundle.mGeneratedAccount;
final AccountDeletionRecord deletionRecord = mCppCache.removeAccount(generatedAccount.getHomeAccountId(), generatedAccount.getEnvironment(), generatedAccount.getRealm());
Assert.assertTrue(deletionRecord.isEmpty());
}
use of com.microsoft.identity.common.internal.cache.AccountDeletionRecord in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalCppOAuth2TokenCacheTest method removeNoMatchingAccount.
@Test
public void removeNoMatchingAccount() throws ClientException {
// Get the generated account
final AccountRecord generatedAccount = mTestBundle.mGeneratedAccount;
// Save it to the cache
mCppCache.saveAccountRecord(generatedAccount);
mCppCache.saveCredentials(null, mTestBundle.mGeneratedRefreshToken);
// Call remove with a different realm
final AccountDeletionRecord deletionRecord = mCppCache.removeAccount(generatedAccount.getHomeAccountId(), generatedAccount.getEnvironment(), REALM2);
// Check the receipt, should remove nothing
Assert.assertEquals(0, deletionRecord.size());
}
use of com.microsoft.identity.common.internal.cache.AccountDeletionRecord in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalCppOAuth2TokenCacheTest method removeAccountTest.
@Test
public void removeAccountTest() throws ClientException {
// Get the generated account
final AccountRecord generatedAccount = mTestBundle.mGeneratedAccount;
// Save it to the cache
mCppCache.saveAccountRecord(generatedAccount);
mCppCache.saveCredentials(null, mTestBundle.mGeneratedRefreshToken);
// Call remove
final AccountDeletionRecord deletionRecord = mCppCache.removeAccount(generatedAccount.getHomeAccountId(), generatedAccount.getEnvironment(), generatedAccount.getRealm());
// Check the receipt
Assert.assertEquals(generatedAccount, deletionRecord.get(0));
// Try to restore it
final AccountRecord restoredAccount = mCppCache.getAccount(generatedAccount.getHomeAccountId(), generatedAccount.getEnvironment(), generatedAccount.getRealm());
// Make sure it doesn't exist....
Assert.assertNull(restoredAccount);
}
Aggregations