diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-06-07 14:21:48 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-06-07 15:09:26 +0200 |
commit | 72c5535492f10024f25f4b641c4c481f203a2872 (patch) | |
tree | a17f62b8fca4338627c668e00773fecacf68494b /apps | |
parent | 2e2ece753f4474d4ba0edbf22e4984335eec51ff (diff) | |
download | nextcloud-server-72c5535492f10024f25f4b641c4c481f203a2872.tar.gz nextcloud-server-72c5535492f10024f25f4b641c4c481f203a2872.zip |
Extend unit tests
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/ApiTest.php | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index b1a9e0dfbfe..058b0c4758c 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -800,6 +800,9 @@ class ApiTest extends TestCase { ->setPermissions(1); $share3 = $this->shareManager->createShare($share3); + /* + * Test as recipient + */ $request = $this->createRequest(['path' => '/', 'subfiles' => 'true']); $ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER3); $result = $ocs->getShares(); @@ -810,9 +813,38 @@ class ApiTest extends TestCase { // we should get exactly one result $this->assertCount(1, $data); - $this->assertEquals($this->subsubfolder, $data[0]['path']); + /* + * Test for first owner/initiator + */ + $request = $this->createRequest([]); + $ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER1); + $result = $ocs->getShares(); + $this->assertTrue($result->succeeded()); + + // test should return one share within $this->folder + $data = $result->getData(); + + // we should get exactly one result + $this->assertCount(1, $data); + $this->assertEquals($this->folder . $this->subfolder, $data[0]['path']); + + /* + * Test for second initiator + */ + $request = $this->createRequest([]); + $ocs = $this->createOCS($request, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->getShares(); + $this->assertTrue($result->succeeded()); + + // test should return one share within $this->folder + $data = $result->getData(); + + // we should get exactly one result + $this->assertCount(1, $data); + $this->assertEquals($this->subfolder . $this->subsubfolder, $data[0]['path']); + $this->shareManager->deleteShare($share1); $this->shareManager->deleteShare($share2); $this->shareManager->deleteShare($share3); |