Browse Source

remove accounts, as otherwise account from AbstractOnServer might be there

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 years ago
parent
commit
b29767b648
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/androidTest/java/com/owncloud/android/AbstractIT.java

+ 5 - 1
src/androidTest/java/com/owncloud/android/AbstractIT.java

@@ -77,9 +77,13 @@ public abstract class AbstractIT {
     public static void beforeAll() {
     public static void beforeAll() {
         try {
         try {
             targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
             targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+            AccountManager platformAccountManager = AccountManager.get(targetContext);
+
+            for (Account account : platformAccountManager.getAccounts()) {
+                platformAccountManager.removeAccountExplicitly(account);
+            }
 
 
             Account temp = new Account("test@server.com", MainApp.getAccountType(targetContext));
             Account temp = new Account("test@server.com", MainApp.getAccountType(targetContext));
-            AccountManager platformAccountManager = AccountManager.get(targetContext);
             platformAccountManager.addAccountExplicitly(temp, "password", null);
             platformAccountManager.addAccountExplicitly(temp, "password", null);
             platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
             platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
             platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, "test");
             platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, "test");