diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-03-18 16:37:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 16:37:29 +0100 |
commit | 6ade109b60a5390849f71064ac1c96ff2c7d0d06 (patch) | |
tree | a1bbf4759d1152c739e5b0b446c2c4c06e873794 /apps/files_sharing/tests | |
parent | 8f22d48f7a642bd23e1c2d04a1800d6a169140e5 (diff) | |
parent | d650de13a4af452f8acadcfa5149f58642d8d7be (diff) | |
download | nextcloud-server-6ade109b60a5390849f71064ac1c96ff2c7d0d06.tar.gz nextcloud-server-6ade109b60a5390849f71064ac1c96ff2c7d0d06.zip |
Merge pull request #26194 from nextcloud/techdebt/noid/remove-duplicate-sharing-unit-integration-tests-group-permission
Remove duplicate unit test in sharing that checks for group permission updates
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/SharedMountTest.php | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 2979ce0f58b..2764dc1032d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -264,141 +264,6 @@ class SharedMountTest extends TestCase { ]; } - public function dataPermissionMovedGroupShare() { - $data = []; - - $powerset = function ($permissions) { - $results = [\OCP\Constants::PERMISSION_READ]; - - foreach ($permissions as $permission) { - foreach ($results as $combination) { - $results[] = $permission | $combination; - } - } - return $results; - }; - - //Generate file permissions - $permissions = [ - \OCP\Constants::PERMISSION_UPDATE, - \OCP\Constants::PERMISSION_SHARE, - ]; - - $allPermissions = $powerset($permissions); - - foreach ($allPermissions as $before) { - foreach ($allPermissions as $after) { - if ($before === $after) { - continue; - } - - $data[] = [ - 'file', - $before, - $after, - ]; - } - } - - //Generate folder permissions - $permissions = [ - \OCP\Constants::PERMISSION_UPDATE, - \OCP\Constants::PERMISSION_CREATE, - \OCP\Constants::PERMISSION_SHARE, - \OCP\Constants::PERMISSION_DELETE, - ]; - - $allPermissions = $powerset($permissions); - - foreach ($allPermissions as $before) { - foreach ($allPermissions as $after) { - if ($before === $after) { - continue; - } - - $data[] = [ - 'folder', - $before, - $after, - ]; - } - } - - return $data; - } - - - - /** - * moved mountpoints of a group share should keep the same permission as their parent group share. - * See #15253 - * - * @dataProvider dataPermissionMovedGroupShare - */ - public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) { - $this->markTestSkipped('Unreliable test'); - if ($type === 'file') { - $path = $this->filename; - } elseif ($type === 'folder') { - $path = $this->folder; - } - - $testGroup = $this->groupManager->createGroup('testGroup'); - $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); - $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); - $user3 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER3); - $testGroup->addUser($user1); - $testGroup->addUser($user2); - $testGroup->addUser($user3); - - // Share item with group - $share = $this->share( - IShare::TYPE_GROUP, - $path, - self::TEST_FILES_SHARING_API_USER1, - 'testGroup', - $beforePerm - ); - $this->shareManager->acceptShare($share, $user1->getUID()); - $this->shareManager->acceptShare($share, $user2->getUID()); - $this->shareManager->acceptShare($share, $user3->getUID()); - - // Login as user 2 and verify the item exists - self::loginHelper(self::TEST_FILES_SHARING_API_USER2); - $this->assertTrue(\OC\Files\Filesystem::file_exists($path)); // TODO: unreliable - this is sometimes false - $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2); - $this->assertEquals($beforePerm, $result->getPermissions()); - - // Now move the item forcing a new entry in the share table - \OC\Files\Filesystem::rename($path, 'newPath'); - $this->assertTrue(\OC\Files\Filesystem::file_exists('newPath')); - $this->assertFalse(\OC\Files\Filesystem::file_exists($path)); - - // change permissions - $share->setPermissions($afterPerm); - $this->shareManager->updateShare($share); - - // Login as user 3 and verify that the permissions are changed - self::loginHelper(self::TEST_FILES_SHARING_API_USER3); - $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER3); - $this->assertNotEmpty($result); - $this->assertEquals($afterPerm, $result->getPermissions()); - - // Login as user 2 and verify that the permissions are changed - self::loginHelper(self::TEST_FILES_SHARING_API_USER2); - $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2); - $this->assertNotEmpty($result); - $this->assertEquals($afterPerm, $result->getPermissions()); - $this->assertEquals('/newPath', $result->getTarget()); - - //cleanup - self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - $this->shareManager->deleteShare($share); - $testGroup->removeUser($user1); - $testGroup->removeUser($user2); - $testGroup->removeUser($user3); - } - /** * If the permissions on a group share are upgraded be sure to still respect * removed shares by a member of that group |