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
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-11-10 17:57:31 +0300
committerRobin Appelman <robin@icewind.nl>2016-11-16 17:24:30 +0300
commit91851c37be39e0d45e7edd4f770e0254d1ae75fa (patch)
tree8d534460d8b0ae1e9c0d04977f65c5c2c1ec90e8 /tests/lib/Lockdown
parent4837904ad6c8f6b82f77740f91e08133dc97ffd0 (diff)
add tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Lockdown')
-rw-r--r--tests/lib/Lockdown/LockdownManagerTest.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php
new file mode 100644
index 00000000000..4cbd9d71a5c
--- /dev/null
+++ b/tests/lib/Lockdown/LockdownManagerTest.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Lockdown;
+
+use OC\Authentication\Token\DefaultToken;
+use OC\Lockdown\LockdownManager;
+use Test\TestCase;
+
+class LockdownManagerTest extends TestCase {
+ public function testCanAccessFilesystemDisabled() {
+ $manager = new LockdownManager();
+ $this->assertTrue($manager->canAccessFilesystem());
+ }
+
+ public function testCanAccessFilesystemAllowed() {
+ $token = new DefaultToken();
+ $token->setScope(['filesystem' => true]);
+ $manager = new LockdownManager();
+ $manager->setToken($token);
+ $this->assertTrue($manager->canAccessFilesystem());
+ }
+
+ public function testCanAccessFilesystemNotAllowed() {
+ $token = new DefaultToken();
+ $token->setScope(['filesystem' => false]);
+ $manager = new LockdownManager();
+ $manager->setToken($token);
+ $this->assertFalse($manager->canAccessFilesystem());
+ }
+}