Przeglądaj źródła

Fix DocumentsStorageProviderIT for new root ID

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 3 lat temu
rodzic
commit
8ef80aa105

+ 1 - 1
app/src/androidTest/java/com/owncloud/android/providers/DocumentsStorageProviderIT.kt

@@ -38,7 +38,7 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
     private val authority = context.getString(R.string.document_provider_authority)
     private val authority = context.getString(R.string.document_provider_authority)
 
 
     private val rootFileId = storageManager.getFileByEncryptedRemotePath(ROOT_PATH).fileId
     private val rootFileId = storageManager.getFileByEncryptedRemotePath(ROOT_PATH).fileId
-    private val documentId = "${user.hashCode()}${DOCUMENTID_SEPARATOR}$rootFileId"
+    private val documentId = "${DocumentsStorageProvider.rootIdForUser(user)}${DOCUMENTID_SEPARATOR}$rootFileId"
     private val uri = DocumentsContract.buildTreeDocumentUri(authority, documentId)
     private val uri = DocumentsContract.buildTreeDocumentUri(authority, documentId)
     private val rootDir get() = DocumentFile.fromTreeUri(context, uri)!!
     private val rootDir get() = DocumentFile.fromTreeUri(context, uri)!!
 
 

+ 2 - 1
app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java

@@ -683,7 +683,8 @@ public class DocumentsStorageProvider extends DocumentsProvider {
         return rootIdToStorageManager.get(rootId);
         return rootIdToStorageManager.get(rootId);
     }
     }
 
 
-    private String rootIdForUser(User user) {
+    @VisibleForTesting
+    public static String rootIdForUser(User user) {
         return HashUtil.md5Hash(user.getAccountName());
         return HashUtil.md5Hash(user.getAccountName());
     }
     }