aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Share20
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2022-08-01 15:27:23 +0200
committerJulien Veyssier <eneiluj@posteo.net>2022-08-02 01:35:10 +0200
commitacc68e9f937e93a483ddfbb3fb5555dacf7a9ace (patch)
treec133ddad81dc4de10d23e901aa115676f117561a /tests/lib/Share20
parente251e0c31435ab2d80f8f39c3380f5634a4c9c6f (diff)
downloadnextcloud-server-acc68e9f937e93a483ddfbb3fb5555dacf7a9ace.tar.gz
nextcloud-server-acc68e9f937e93a483ddfbb3fb5555dacf7a9ace.zip
fix share manager tests
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'tests/lib/Share20')
-rw-r--r--tests/lib/Share20/ManagerTest.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index ab296172a3c..4e613d1cf5c 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -1915,13 +1915,31 @@ class ManagerTest extends \Test\TestCase {
}
- public function testLinkCreateChecksNoPublicUpload() {
+ public function testFileLinkCreateChecksNoPublicUpload() {
+ $share = $this->manager->newShare();
+
+ $share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
+ $share->setNodeType('file');
+
+ $this->config
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['core', 'shareapi_allow_links', 'yes', 'yes'],
+ ['core', 'shareapi_allow_public_upload', 'yes', 'no']
+ ]);
+
+ self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
+ $this->addToAssertionCount(1);
+ }
+
+ public function testFolderLinkCreateChecksNoPublicUpload() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Public upload is not allowed');
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
+ $share->setNodeType('folder');
$this->config
->method('getAppValue')
@@ -1937,6 +1955,9 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
+ $share->setSharedWith('sharedWith');
+ $folder = $this->createMock(\OC\Files\Node\Folder::class);
+ $share->setNode($folder);
$this->config
->method('getAppValue')
@@ -1953,6 +1974,9 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_READ);
+ $share->setSharedWith('sharedWith');
+ $folder = $this->createMock(\OC\Files\Node\Folder::class);
+ $share->setNode($folder);
$this->config
->method('getAppValue')
@@ -2947,6 +2971,9 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setShareType(IShare::TYPE_LINK)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
+ $share->setSharedWith('sharedWith');
+ $folder = $this->createMock(\OC\Files\Node\Folder::class);
+ $share->setNode($folder);
$this->config
->expects($this->at(1))