Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-26 13:27:49 +0300
committerVincent Petry <pvince81@owncloud.com>2015-03-26 13:27:49 +0300
commitd04ad4be26f0f09297748cac23582083c364ea25 (patch)
treeee49b68b6cfb854a28627874adab6be390ca8346 /tests
parent9bc1f0a67ab3ddbb7dca2d85ea9fc0b7a8365e21 (diff)
parent9d0ea7fa11ec81bca602b1bd08f1de4e2aa6d58c (diff)
Merge pull request #15052 from rullzer/backport-15025
[stable8] Backport of #15025: OCS Respect enforced date
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share/share.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 1ef62dc2b07..42bb82968af 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -1051,6 +1051,41 @@ class Test_Share extends \Test\TestCase {
),
);
}
+
+ /**
+ * Ensure that we do not allow removing a an expiration date from a link share if this
+ * is enforced by the settings.
+ */
+ public function testClearExpireDateWhileEnforced() {
+ OC_User::setUserId($this->user1);
+
+ \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
+ \OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
+ \OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'yes');
+
+ $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ $this->assertInternalType(
+ 'string',
+ $token,
+ 'Failed asserting that user 1 successfully shared text.txt as link with token.'
+ );
+
+ $setExpireDateFailed = false;
+ try {
+ $this->assertTrue(
+ OCP\Share::setExpirationDate('test', 'test.txt', '', ''),
+ 'Failed asserting that user 1 successfully set an expiration date for the test.txt share.'
+ );
+ } catch (\Exception $e) {
+ $setExpireDateFailed = true;
+ }
+
+ $this->assertTrue($setExpireDateFailed);
+
+ \OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date');
+ \OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days');
+ \OC_Appconfig::deleteKey('core', 'shareapi_enforce_expire_date');
+ }
}
class DummyShareClass extends \OC\Share\Share {