summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2016-03-02 11:27:29 +0100
committerBjörn Schießle <schiessle@owncloud.com>2016-04-26 11:06:55 +0200
commitd86f8ba5f8718329fb0742be3e18f229c1f56a34 (patch)
treedf632abfaa93c3d075d9f066099ca1706ee24d05 /apps/encryption/tests
parent088ffd05d7a60c5be2dbe8b56b6223a774b0822c (diff)
downloadnextcloud-server-d86f8ba5f8718329fb0742be3e18f229c1f56a34.tar.gz
nextcloud-server-d86f8ba5f8718329fb0742be3e18f229c1f56a34.zip
if we don't have a encrypted file key we can return a empty string right away
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/lib/crypto/encryptalltest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/crypto/encryptalltest.php b/apps/encryption/tests/lib/crypto/encryptalltest.php
index 837883fded3..d31f58377c4 100644
--- a/apps/encryption/tests/lib/crypto/encryptalltest.php
+++ b/apps/encryption/tests/lib/crypto/encryptalltest.php
@@ -153,6 +153,36 @@ class EncryptAllTest extends TestCase {
}
+ public function testEncryptAllWithMasterKey() {
+ /** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
+ $encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')
+ ->setConstructorArgs(
+ [
+ $this->setupUser,
+ $this->userManager,
+ $this->view,
+ $this->keyManager,
+ $this->util,
+ $this->config,
+ $this->mailer,
+ $this->l,
+ $this->questionHelper,
+ $this->secureRandom
+ ]
+ )
+ ->setMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords'])
+ ->getMock();
+
+ $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(true);
+ $encryptAll->expects($this->never())->method('createKeyPairs');
+ $this->keyManager->expects($this->once())->method('validateMasterKey');
+ $encryptAll->expects($this->at(0))->method('encryptAllUsersFiles')->with();
+ $encryptAll->expects($this->never())->method('outputPasswords');
+
+ $encryptAll->encryptAll($this->inputInterface, $this->outputInterface);
+
+ }
+
public function testCreateKeyPairs() {
/** @var EncryptAll | \PHPUnit_Framework_MockObject_MockObject $encryptAll */
$encryptAll = $this->getMockBuilder('OCA\Encryption\Crypto\EncryptAll')