Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2a578347 authored by tobiasKaminsky's avatar tobiasKaminsky
Browse files

add test to check for duplicate folder creation

parent 82061a48
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -7,7 +7,9 @@
 */
package com.owncloud.android;

import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.FOLDER_ALREADY_EXISTS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.nextcloud.test.RandomStringGenerator;
@@ -66,6 +68,23 @@ public class CreateFolderRemoteOperationIT extends AbstractIT {
        assertTrue(result.isSuccess());
    }

    /**
     * Test duplicate Folder
     */
    @Test
    public void testCreateDuplicateFolder() {
        String remotePath = mFullPath2FolderBase + "duplicateFolder";
        mCreatedFolderPaths.add(remotePath);
        RemoteOperationResult<String> result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
        assertTrue(result.isSuccess());

        // Create folder again
        mCreatedFolderPaths.add(remotePath);
        result = new CreateFolderRemoteOperation(remotePath, true).execute(client);
        assertFalse(result.isSuccess());
        assertEquals(FOLDER_ALREADY_EXISTS, result.getCode());
    }

    @Test
    public void testFileID() {
        String remotePath = mFullPath2FolderBase + "/" + RandomStringGenerator.make(TAG_LENGTH);