diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-07-27 15:11:48 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-07-27 15:39:24 +0200 |
commit | 351cab6bce41b53f9efd4ba9aed4e7435f843691 (patch) | |
tree | f48ea2691c929f03e8af059f42d58ff0d1fceb7d /tests | |
parent | 318d68a9a95cc710aa30c24a84d78da280327aef (diff) | |
download | nextcloud-server-351cab6bce41b53f9efd4ba9aed4e7435f843691.tar.gz nextcloud-server-351cab6bce41b53f9efd4ba9aed4e7435f843691.zip |
skip shared files, if files get decrypted only for a specific user we shouldn't touch files owned by a different user.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Encryption/DecryptAllTest.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index d7cf2fb7baf..ed86b743c3b 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -251,18 +251,29 @@ class DecryptAllTest extends TestCase { ->setMethods(['decryptFile']) ->getMock(); + $storage = $this->getMockBuilder('OCP\Files\Storage') + ->disableOriginalConstructor()->getMock(); + + + $sharedStorage = $this->getMockBuilder('OCP\Files\Storage') + ->disableOriginalConstructor()->getMock(); + + $sharedStorage->expects($this->once())->method('instanceOfStorage') + ->with('OC\Files\Storage\Shared')->willReturn(true); + $this->view->expects($this->at(0))->method('getDirectoryContent') ->with('/user1/files')->willReturn( [ - new FileInfo('path', null, 'intPath', ['name' => 'foo', 'type'=>'dir'], null), - new FileInfo('path', null, 'intPath', ['name' => 'bar', 'type'=>'file', 'encrypted'=>true], null) + new FileInfo('path', $storage, 'intPath', ['name' => 'foo', 'type'=>'dir'], null), + new FileInfo('path', $storage, 'intPath', ['name' => 'bar', 'type'=>'file', 'encrypted'=>true], null), + new FileInfo('path', $sharedStorage, 'intPath', ['name' => 'shared', 'type'=>'file', 'encrypted'=>true], null), ] ); $this->view->expects($this->at(3))->method('getDirectoryContent') ->with('/user1/files/foo')->willReturn( [ - new FileInfo('path', null, 'intPath', ['name' => 'subfile', 'type'=>'file', 'encrypted'=>true], null) + new FileInfo('path', $storage, 'intPath', ['name' => 'subfile', 'type'=>'file', 'encrypted'=>true], null) ] ); |