diff options
author | Robin Appelman <robin@icewind.nl> | 2017-02-17 15:40:20 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-04-05 17:58:33 +0200 |
commit | baec42e80a74543543064f3af9946b9c4dafddeb (patch) | |
tree | 780c007ecb83b192c090d8a6018fe7a2cb86de43 /tests/lib/Lockdown | |
parent | 6bdd3a167d9872c315236a09233f4a161ae48797 (diff) | |
download | nextcloud-server-baec42e80a74543543064f3af9946b9c4dafddeb.tar.gz nextcloud-server-baec42e80a74543543064f3af9946b9c4dafddeb.zip |
Save the scope of an auth token in the session
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Lockdown')
-rw-r--r-- | tests/lib/Lockdown/LockdownManagerTest.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php index 4cbd9d71a5c..1d206dbf409 100644 --- a/tests/lib/Lockdown/LockdownManagerTest.php +++ b/tests/lib/Lockdown/LockdownManagerTest.php @@ -23,18 +23,29 @@ namespace Test\Lockdown; use OC\Authentication\Token\DefaultToken; use OC\Lockdown\LockdownManager; +use OCP\ISession; use Test\TestCase; class LockdownManagerTest extends TestCase { + private $sessionCallback; + + public function setUp() { + parent::setUp(); + + $this->sessionCallback = function() { + return $this->createMock(ISession::class); + }; + } + public function testCanAccessFilesystemDisabled() { - $manager = new LockdownManager(); + $manager = new LockdownManager($this->sessionCallback); $this->assertTrue($manager->canAccessFilesystem()); } public function testCanAccessFilesystemAllowed() { $token = new DefaultToken(); $token->setScope(['filesystem' => true]); - $manager = new LockdownManager(); + $manager = new LockdownManager($this->sessionCallback); $manager->setToken($token); $this->assertTrue($manager->canAccessFilesystem()); } @@ -42,7 +53,7 @@ class LockdownManagerTest extends TestCase { public function testCanAccessFilesystemNotAllowed() { $token = new DefaultToken(); $token->setScope(['filesystem' => false]); - $manager = new LockdownManager(); + $manager = new LockdownManager($this->sessionCallback); $manager->setToken($token); $this->assertFalse($manager->canAccessFilesystem()); } |