|
@@ -53,6 +53,7 @@ import org.junit.Before;
|
|
|
import org.junit.BeforeClass;
|
|
|
import org.junit.Rule;
|
|
|
import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
@@ -61,6 +62,8 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Random;
|
|
|
|
|
|
+import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
|
+
|
|
|
import static com.owncloud.android.lib.resources.status.OwnCloudVersion.nextcloud_19;
|
|
|
import static junit.framework.TestCase.assertEquals;
|
|
|
import static junit.framework.TestCase.assertFalse;
|
|
@@ -68,6 +71,7 @@ import static junit.framework.TestCase.assertNotNull;
|
|
|
import static junit.framework.TestCase.assertTrue;
|
|
|
import static org.junit.Assume.assumeTrue;
|
|
|
|
|
|
+@RunWith(AndroidJUnit4.class)
|
|
|
public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
public enum Action {
|
|
|
CREATE_FOLDER,
|
|
@@ -88,8 +92,9 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
public RetryTestRule retryTestRule = new RetryTestRule();
|
|
|
|
|
|
@BeforeClass
|
|
|
- public static void initClass() {
|
|
|
+ public static void initClass() throws Exception {
|
|
|
arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
|
|
|
+ createKeys();
|
|
|
}
|
|
|
|
|
|
@Before
|
|
@@ -230,6 +235,29 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
deleteFile(1);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void deleteFolder() throws Exception {
|
|
|
+ init();
|
|
|
+
|
|
|
+ // create folder, go into it
|
|
|
+ OCFile createdFolder = createFolder(0);
|
|
|
+ assertNotNull(createdFolder);
|
|
|
+ currentFolder = createdFolder;
|
|
|
+
|
|
|
+ uploadFile(1);
|
|
|
+ goUp(1);
|
|
|
+
|
|
|
+ // delete folder
|
|
|
+ assertTrue(new RemoveFileOperation(createdFolder,
|
|
|
+ false,
|
|
|
+ user,
|
|
|
+ false,
|
|
|
+ targetContext,
|
|
|
+ getStorageManager())
|
|
|
+ .execute(client)
|
|
|
+ .isSuccess());
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void downloadFile() throws Exception {
|
|
|
init();
|
|
@@ -488,7 +516,6 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
encFolder.setEncrypted(true);
|
|
|
getStorageManager().saveFolder(encFolder, new ArrayList<>(), new ArrayList<>());
|
|
|
|
|
|
- createKeys();
|
|
|
|
|
|
// delete keys
|
|
|
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PRIVATE_KEY);
|
|
@@ -503,7 +530,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
GetPublicKeyOperation publicKeyOperation = new GetPublicKeyOperation();
|
|
|
RemoteOperationResult publicKeyResult = publicKeyOperation.execute(account, targetContext);
|
|
|
|
|
|
- assertTrue(publicKeyResult.isSuccess());
|
|
|
+ assertTrue("Result code:" + publicKeyResult.getHttpCode(), publicKeyResult.isSuccess());
|
|
|
|
|
|
String publicKeyFromServer = (String) publicKeyResult.getData().get(0);
|
|
|
arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
|
|
@@ -530,7 +557,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
/*
|
|
|
TODO do not c&p code
|
|
|
*/
|
|
|
- private void createKeys() throws Exception {
|
|
|
+ private static void createKeys() throws Exception {
|
|
|
String publicKey;
|
|
|
|
|
|
// Create public/private key pair
|
|
@@ -571,7 +598,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private String generateMnemonicString() {
|
|
|
+ private static String generateMnemonicString() {
|
|
|
return "1 2 3 4 5 6";
|
|
|
}
|
|
|
|