[Pkg-owncloud-commits] [owncloud] 11/79: add unit tests for share target conflict with group shares

David Prévot taffit at moszumanska.debian.org
Tue Sep 1 20:55:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit cb791c7fe28dc7f2cda469a1e9890f62d4202ef5
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Aug 5 15:41:03 2015 +0200

    add unit tests for share target conflict with group shares
---
 apps/files_sharing/tests/sharedstorage.php | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php
index 7c28d04..de510cf 100644
--- a/apps/files_sharing/tests/sharedstorage.php
+++ b/apps/files_sharing/tests/sharedstorage.php
@@ -441,4 +441,43 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
 		self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 		$this->view->unlink($this->folder);
 	}
+
+	public function testNameConflict() {
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+		$view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+		$view1->mkdir('foo');
+		$folderInfo1 = $view1->getFileInfo('foo');
+
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
+		$view3 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files');
+		$view3->mkdir('foo');
+		$folderInfo2 = $view3->getFileInfo('foo');
+
+		// share a folder with the same name from two different users to the same user
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+		\OCP\Share::shareItem('folder', $folderInfo1['fileid'], \OCP\Share::SHARE_TYPE_GROUP,
+			self::TEST_FILES_SHARING_API_GROUP1, 31);
+
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
+
+		\OCP\Share::shareItem('folder', $folderInfo2['fileid'], \OCP\Share::SHARE_TYPE_GROUP,
+			self::TEST_FILES_SHARING_API_GROUP1, 31);
+
+		self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+		$view2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+
+		$this->assertTrue($view2->file_exists('/foo'));
+		$this->assertTrue($view2->file_exists('/foo (2)'));
+
+		$mount = $view2->getMount('/foo');
+		$this->assertInstanceOf('\OCA\Files_Sharing\SharedMount', $mount);
+		/** @var \OC\Files\Storage\Shared $storage */
+		$storage = $mount->getStorage();
+
+		$source = $storage->getFile('');
+		$this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $source['uid_owner']);
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list