diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-03-19 10:47:09 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-03-19 10:47:09 +0100 |
commit | dd3307dd19bb2b61b194ba7962035a6ceae64249 (patch) | |
tree | e4ba5fc657e2267e461c8720db1568368c4a4d0e /apps | |
parent | 3c39658a1ca3a720072df3d98fa012208c6f73e3 (diff) | |
download | nextcloud-server-dd3307dd19bb2b61b194ba7962035a6ceae64249.tar.gz nextcloud-server-dd3307dd19bb2b61b194ba7962035a6ceae64249.zip |
Added unit test
Tests added to make sure that removing an expire date when this is
enforced is not allowed.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/api.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 9256f9bcc85..371c94a8c88 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -1079,6 +1079,24 @@ class Test_Files_Sharing_Api extends TestCase { $this->assertTrue(is_array($updatedLinkShare)); $this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']); + + // Try to remove expire date + $params = array(); + $params['id'] = $linkShare['id']; + $params['_put'] = ['expireDate' => '']; + + $result = \OCA\Files_Sharing\API\Local::updateShare($params); + + $this->assertFalse($result->succeeded()); + + $items = \OCP\Share::getItemShared('file', $linkShare['file_source']); + + $updatedLinkShare = reset($items); + + // date shouldn't be changed + $this->assertTrue(is_array($updatedLinkShare)); + $this->assertEquals($dateWithinRange->format('Y-m-d') . ' 00:00:00', $updatedLinkShare['expiration']); + // cleanup $config->setAppValue('core', 'shareapi_default_expire_date', 'no'); $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); |