Skip to content

Commit 458ee43

Browse files
authored
Merge pull request #10390 from nextcloud/deletedEncryptedSubfolder
Deleted encrypted subfolder
2 parents d31f3f7 + c1f53e6 commit 458ee43

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

app/src/androidTest/java/com/nextcloud/client/EndToEndRandomIT.java

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.junit.BeforeClass;
5454
import org.junit.Rule;
5555
import org.junit.Test;
56+
import org.junit.runner.RunWith;
5657

5758
import java.io.File;
5859
import java.io.IOException;
@@ -61,13 +62,16 @@
6162
import java.util.List;
6263
import java.util.Random;
6364

65+
import androidx.test.ext.junit.runners.AndroidJUnit4;
66+
6467
import static com.owncloud.android.lib.resources.status.OwnCloudVersion.nextcloud_19;
6568
import static junit.framework.TestCase.assertEquals;
6669
import static junit.framework.TestCase.assertFalse;
6770
import static junit.framework.TestCase.assertNotNull;
6871
import static junit.framework.TestCase.assertTrue;
6972
import static org.junit.Assume.assumeTrue;
7073

74+
@RunWith(AndroidJUnit4.class)
7175
public class EndToEndRandomIT extends AbstractOnServerIT {
7276
public enum Action {
7377
CREATE_FOLDER,
@@ -88,8 +92,9 @@ public enum Action {
8892
public RetryTestRule retryTestRule = new RetryTestRule();
8993

9094
@BeforeClass
91-
public static void initClass() {
95+
public static void initClass() throws Exception {
9296
arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
97+
createKeys();
9398
}
9499

95100
@Before
@@ -230,6 +235,29 @@ public void deleteFile() throws Exception {
230235
deleteFile(1);
231236
}
232237

238+
@Test
239+
public void deleteFolder() throws Exception {
240+
init();
241+
242+
// create folder, go into it
243+
OCFile createdFolder = createFolder(0);
244+
assertNotNull(createdFolder);
245+
currentFolder = createdFolder;
246+
247+
uploadFile(1);
248+
goUp(1);
249+
250+
// delete folder
251+
assertTrue(new RemoveFileOperation(createdFolder,
252+
false,
253+
user,
254+
false,
255+
targetContext,
256+
getStorageManager())
257+
.execute(client)
258+
.isSuccess());
259+
}
260+
233261
@Test
234262
public void downloadFile() throws Exception {
235263
init();
@@ -488,7 +516,6 @@ public void reInit() throws Exception {
488516
encFolder.setEncrypted(true);
489517
getStorageManager().saveFolder(encFolder, new ArrayList<>(), new ArrayList<>());
490518

491-
createKeys();
492519

493520
// delete keys
494521
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PRIVATE_KEY);
@@ -503,7 +530,7 @@ private void useExistingKeys() throws Exception {
503530
GetPublicKeyOperation publicKeyOperation = new GetPublicKeyOperation();
504531
RemoteOperationResult publicKeyResult = publicKeyOperation.execute(account, targetContext);
505532

506-
assertTrue(publicKeyResult.isSuccess());
533+
assertTrue("Result code:" + publicKeyResult.getHttpCode(), publicKeyResult.isSuccess());
507534

508535
String publicKeyFromServer = (String) publicKeyResult.getData().get(0);
509536
arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
@@ -530,7 +557,7 @@ private void useExistingKeys() throws Exception {
530557
/*
531558
TODO do not c&p code
532559
*/
533-
private void createKeys() throws Exception {
560+
private static void createKeys() throws Exception {
534561
String publicKey;
535562

536563
// Create public/private key pair
@@ -571,7 +598,7 @@ private void createKeys() throws Exception {
571598
}
572599
}
573600

574-
private String generateMnemonicString() {
601+
private static String generateMnemonicString() {
575602
return "1 2 3 4 5 6";
576603
}
577604

app/src/main/java/com/owncloud/android/files/FileMenuFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ private void filterSelectAll(List<Integer> toShow, List<Integer> toHide, boolean
421421
}
422422

423423
private void filterRemove(List<Integer> toShow, List<Integer> toHide, boolean synchronizing) {
424-
if (files.isEmpty() || synchronizing || containsEncryptedFolder() || containsLockedFile()) {
424+
if (files.isEmpty() || synchronizing || containsLockedFile()) {
425425
toHide.add(R.id.action_remove_file);
426426
} else {
427427
toShow.add(R.id.action_remove_file);

0 commit comments

Comments
 (0)