diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2016-03-02 11:16:53 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2016-04-26 11:06:55 +0200 |
commit | 088ffd05d7a60c5be2dbe8b56b6223a774b0822c (patch) | |
tree | f76b3015386700c01a8d5dcf8994567c6389167c /apps/encryption/tests | |
parent | 14c34919774484d095d26ad2a7246fc897dc2d41 (diff) | |
download | nextcloud-server-088ffd05d7a60c5be2dbe8b56b6223a774b0822c.tar.gz nextcloud-server-088ffd05d7a60c5be2dbe8b56b6223a774b0822c.zip |
don't create a private-/public-key pair for each user if the master key is enabled
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r-- | apps/encryption/tests/lib/crypto/encryptalltest.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/encryption/tests/lib/crypto/encryptalltest.php b/apps/encryption/tests/lib/crypto/encryptalltest.php index 04d931342a7..837883fded3 100644 --- a/apps/encryption/tests/lib/crypto/encryptalltest.php +++ b/apps/encryption/tests/lib/crypto/encryptalltest.php @@ -31,6 +31,9 @@ class EncryptAllTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject | \OCA\Encryption\KeyManager */ protected $keyManager; + /** @var \PHPUnit_Framework_MockObject_MockObject | \OCA\Encryption\Util */ + protected $util; + /** @var \PHPUnit_Framework_MockObject_MockObject | \OCP\IUserManager */ protected $userManager; @@ -73,6 +76,8 @@ class EncryptAllTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->keyManager = $this->getMockBuilder('OCA\Encryption\KeyManager') ->disableOriginalConstructor()->getMock(); + $this->util = $this->getMockBuilder('OCA\Encryption\Util') + ->disableOriginalConstructor()->getMock(); $this->userManager = $this->getMockBuilder('OCP\IUserManager') ->disableOriginalConstructor()->getMock(); $this->view = $this->getMockBuilder('OC\Files\View') @@ -110,6 +115,7 @@ class EncryptAllTest extends TestCase { $this->userManager, $this->view, $this->keyManager, + $this->util, $this->config, $this->mailer, $this->l, @@ -127,6 +133,7 @@ class EncryptAllTest extends TestCase { $this->userManager, $this->view, $this->keyManager, + $this->util, $this->config, $this->mailer, $this->l, @@ -137,6 +144,7 @@ class EncryptAllTest extends TestCase { ->setMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords']) ->getMock(); + $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); $encryptAll->expects($this->at(0))->method('createKeyPairs')->with(); $encryptAll->expects($this->at(1))->method('encryptAllUsersFiles')->with(); $encryptAll->expects($this->at(2))->method('outputPasswords')->with(); @@ -154,6 +162,7 @@ class EncryptAllTest extends TestCase { $this->userManager, $this->view, $this->keyManager, + $this->util, $this->config, $this->mailer, $this->l, @@ -202,6 +211,7 @@ class EncryptAllTest extends TestCase { $this->userManager, $this->view, $this->keyManager, + $this->util, $this->config, $this->mailer, $this->l, @@ -212,6 +222,8 @@ class EncryptAllTest extends TestCase { ->setMethods(['encryptUsersFiles']) ->getMock(); + $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); + // set protected property $output $this->invokePrivate($encryptAll, 'output', [$this->outputInterface]); $this->invokePrivate($encryptAll, 'userPasswords', [['user1' => 'pwd1', 'user2' => 'pwd2']]); @@ -232,6 +244,7 @@ class EncryptAllTest extends TestCase { $this->userManager, $this->view, $this->keyManager, + $this->util, $this->config, $this->mailer, $this->l, @@ -239,9 +252,10 @@ class EncryptAllTest extends TestCase { $this->secureRandom ] ) - ->setMethods(['encryptFile']) + ->setMethods(['encryptFile', 'setupUserFS']) ->getMock(); + $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); $this->view->expects($this->at(0))->method('getDirectoryContent') ->with('/user1/files')->willReturn( @@ -268,8 +282,8 @@ class EncryptAllTest extends TestCase { } ); - $encryptAll->expects($this->at(0))->method('encryptFile')->with('/user1/files/bar'); - $encryptAll->expects($this->at(1))->method('encryptFile')->with('/user1/files/foo/subfile'); + $encryptAll->expects($this->at(1))->method('encryptFile')->with('/user1/files/bar'); + $encryptAll->expects($this->at(2))->method('encryptFile')->with('/user1/files/foo/subfile'); $progressBar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar') ->disableOriginalConstructor()->getMock(); |