diff --git a/tests/res/values/setup.xml b/tests/res/values/setup.xml
index 4839b1bc..88bad26a 100644
--- a/tests/res/values/setup.xml
+++ b/tests/res/values/setup.xml
@@ -24,9 +24,9 @@
-->
-
+ https://daily.owncloud.com/master/owncloud
/remote.php/webdav
-
-
+ maria
+ maria
true
diff --git a/tests/src/com/owncloud/android/lib/test_project/TestActivity.java b/tests/src/com/owncloud/android/lib/test_project/TestActivity.java
index b63a9990..3fb5b84b 100644
--- a/tests/src/com/owncloud/android/lib/test_project/TestActivity.java
+++ b/tests/src/com/owncloud/android/lib/test_project/TestActivity.java
@@ -30,8 +30,10 @@ import com.owncloud.android.lib.network.OwnCloudClientFactory;
import com.owncloud.android.lib.network.OwnCloudClient;
import com.owncloud.android.lib.operations.common.RemoteFile;
import com.owncloud.android.lib.operations.common.RemoteOperationResult;
+import com.owncloud.android.lib.operations.common.ShareType;
import com.owncloud.android.lib.operations.remote.ChunkedUploadRemoteFileOperation;
import com.owncloud.android.lib.operations.remote.CreateRemoteFolderOperation;
+import com.owncloud.android.lib.operations.remote.CreateShareRemoteOperation;
import com.owncloud.android.lib.operations.remote.DownloadRemoteFileOperation;
import com.owncloud.android.lib.operations.remote.GetRemoteSharesOperation;
import com.owncloud.android.lib.operations.remote.ReadRemoteFolderOperation;
@@ -190,6 +192,11 @@ public class TestActivity extends Activity {
return result;
}
+
+ /** Access to the library method to Get Shares
+ *
+ * @return
+ */
public RemoteOperationResult getShares(){
GetRemoteSharesOperation getOperation = new GetRemoteSharesOperation();
@@ -197,4 +204,32 @@ public class TestActivity extends Activity {
return result;
}
+
+ /** Access to the library method to Create Share
+ * @param path Full path of the file/folder being shared. Mandatory argument
+ * @param shareType ‘0’ = user, ‘1’ = group, ‘3’ = Public link. Mandatory argument
+ * @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1
+ * @param publicUpload If ‘false’ (default) public cannot upload to a public shared folder.
+ * If ‘true’ public can upload to a shared folder. Only available for public link shares
+ * @param password Password to protect a public link share. Only available for public link shares
+ * @param permissions 1 - Read only – Default for “public” shares
+ * 2 - Update
+ * 4 - Create
+ * 8 - Delete
+ * 16- Re-share
+ * 31- All above – Default for “private” shares
+ * For user or group shares.
+ * To obtain combinations, add the desired values together.
+ * For instance, for “Re-Share”, “delete”, “read”, “update”, add 16+8+2+1 = 27.
+ *
+ * @return
+ */
+ public RemoteOperationResult createShare(String path, ShareType shareType, String shareWith, boolean publicUpload,
+ String password, int permissions){
+
+ CreateShareRemoteOperation createOperation = new CreateShareRemoteOperation(path, shareType, shareWith, publicUpload, password, permissions);
+ RemoteOperationResult result = createOperation.execute(mClient);
+
+ return result;
+ }
}
diff --git a/tests/test_cases/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java b/tests/test_cases/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java
new file mode 100644
index 00000000..b9e89f0e
--- /dev/null
+++ b/tests/test_cases/src/com/owncloud/android/lib/test_project/test/CreateShareTest.java
@@ -0,0 +1,59 @@
+/* ownCloud Android Library is available under MIT license
+ * Copyright (C) 2014 ownCloud (http://www.owncloud.org/)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+package com.owncloud.android.lib.test_project.test;
+
+import com.owncloud.android.lib.operations.common.RemoteOperationResult;
+import com.owncloud.android.lib.operations.common.ShareType;
+import com.owncloud.android.lib.test_project.TestActivity;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class CreateShareTest extends ActivityInstrumentationTestCase2 {
+
+ /* File to share.*/
+ private final String mFileToShare = "/fileToShare.png";
+
+ private TestActivity mActivity;
+
+ public CreateShareTest() {
+ super(TestActivity.class);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setActivityInitialTouchMode(false);
+ mActivity = getActivity();
+ }
+
+ /**
+ * Test Create Share: the server must support SHARE API
+ */
+ public void testCreateShare() {
+ RemoteOperationResult result = mActivity.createShare(mFileToShare, ShareType.PUBLIC_LINK, "", false, "", 1);
+ assertTrue(result.isSuccess());
+ }
+}