From f847d9409e8864d732151b904f826be6c1228dcd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 23 Jun 2015 14:31:41 +0200 Subject: [PATCH] add unit test for single file share etag propagation --- apps/files_sharing/tests/etagpropagation.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php index 60b7c525e3..710d712534 100644 --- a/apps/files_sharing/tests/etagpropagation.php +++ b/apps/files_sharing/tests/etagpropagation.php @@ -69,9 +69,12 @@ class EtagPropagation extends TestCase { $view1->mkdir('/directReshare'); $view1->mkdir('/sub1/sub2/folder/other'); $view1->mkdir('/sub1/sub2/folder/other'); + $view1->file_put_contents('/foo.txt', 'foobar'); $view1->file_put_contents('/sub1/sub2/folder/file.txt', 'foobar'); $view1->file_put_contents('/sub1/sub2/folder/inside/file.txt', 'foobar'); $folderInfo = $view1->getFileInfo('/sub1/sub2/folder'); + $fileInfo = $view1->getFileInfo('/foo.txt'); + \OCP\Share::shareItem('file', $fileInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31); \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31); \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER3, 31); $folderInfo = $view1->getFileInfo('/directReshare'); @@ -179,6 +182,15 @@ class EtagPropagation extends TestCase { $this->assertAllUnchaged(); } + public function testOwnerWritesToSingleFileShare() { + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); + Filesystem::file_put_contents('/foo.txt', 'bar'); + $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER3]); + $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2]); + + $this->assertAllUnchaged(); + } + public function testOwnerWritesToShareWithReshare() { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/inside/bar.txt', 'bar');