|
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
|
import com.nextcloud.client.preferences.AppPreferences;
|
|
import com.nextcloud.client.preferences.AppPreferences;
|
|
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
|
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
|
import com.owncloud.android.AbstractOnServerIT;
|
|
import com.owncloud.android.AbstractOnServerIT;
|
|
|
|
+import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
|
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
|
|
|
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
@@ -48,4 +49,25 @@ public class UserAccountManagerImplTest extends AbstractOnServerIT {
|
|
// assume that userId == loginname (as we manually set it)
|
|
// assume that userId == loginname (as we manually set it)
|
|
assertEquals(userId, accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID));
|
|
assertEquals(userId, accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void checkName() {
|
|
|
|
+ UserAccountManagerImpl sut = new UserAccountManagerImpl(targetContext, accountManager);
|
|
|
|
+
|
|
|
|
+ Account owner = new Account("John@nextcloud.local", "nextcloud");
|
|
|
|
+ Account account1 = new Account("John@nextcloud.local", "nextcloud");
|
|
|
|
+ Account account2 = new Account("john@nextcloud.local", "nextcloud");
|
|
|
|
+
|
|
|
|
+ OCFile file1 = new OCFile("/test1.pdf");
|
|
|
|
+ file1.setOwnerId("John");
|
|
|
|
+
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, owner));
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, account1));
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, account2));
|
|
|
|
+
|
|
|
|
+ file1.setOwnerId("john");
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, owner));
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, account1));
|
|
|
|
+ assertTrue(sut.accountOwnsFile(file1, account2));
|
|
|
|
+ }
|
|
}
|
|
}
|