mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
add tests for sharing files the users doesn't have access to
This commit is contained in:
parent
850a0e7388
commit
7dafdfbe88
1 changed files with 23 additions and 0 deletions
|
|
@ -878,6 +878,29 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
|
|||
$this->assertSame($expectedResult, $shareApiDummy->correctPathTest($path, $folder));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testShareNonExisting() {
|
||||
\Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
|
||||
|
||||
$id = PHP_INT_MAX - 1;
|
||||
\OCP\Share::shareItem('file', $id, \OCP\Share::SHARE_TYPE_LINK, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testShareNotOwner() {
|
||||
\Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
|
||||
\OC\Files\Filesystem::file_put_contents('foo.txt', 'bar');
|
||||
$info = \OC\Files\Filesystem::getFileInfo('foo.txt');
|
||||
|
||||
\Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
|
||||
|
||||
\OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue