summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-03-02 16:11:01 +0100
committerBjoern Schiessle <bjoern@schiessle.org>2017-03-24 14:55:42 +0100
commit6b9ef15803d16de4f227f4176056c030bbed9ebf (patch)
tree2ad1dda10e405dcc0c06a76b2a7680e6edb98338 /apps/encryption/tests
parent305718370a0a202dbb1848683876ff236ec9f441 (diff)
downloadnextcloud-server-6b9ef15803d16de4f227f4176056c030bbed9ebf.tar.gz
nextcloud-server-6b9ef15803d16de4f227f4176056c030bbed9ebf.zip
Use master key for public links as well
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/KeyManagerTest.php39
1 files changed, 20 insertions, 19 deletions
diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php
index c326f21e506..a8441427a2c 100644
--- a/apps/encryption/tests/KeyManagerTest.php
+++ b/apps/encryption/tests/KeyManagerTest.php
@@ -349,6 +349,19 @@ class KeyManagerTest extends TestCase {
$this->assertTrue($this->instance->getEncryptedFileKey('/'));
}
+ public function dataTestGetFileKey() {
+ return [
+ ['user1', false, 'privateKey', true],
+ ['user1', false, false, ''],
+ ['user1', true, 'privateKey', true],
+ ['user1', true, false, ''],
+ [null, false, 'privateKey', true],
+ [null, false, false, ''],
+ [null, true, 'privateKey', true],
+ [null, true, false, '']
+ ];
+ }
+
/**
* @dataProvider dataTestGetFileKey
*
@@ -363,6 +376,10 @@ class KeyManagerTest extends TestCase {
if ($isMasterKeyEnabled) {
$expectedUid = 'masterKeyId';
+ $this->configMock->expects($this->any())->method('getSystemValue')->with('secret')
+ ->willReturn('password');
+ } else if (!$uid) {
+ $expectedUid = 'systemKeyId';
} else {
$expectedUid = $uid;
}
@@ -379,6 +396,9 @@ class KeyManagerTest extends TestCase {
->with($path, $expectedUid . '.shareKey', 'OC_DEFAULT_MODULE')
->willReturn(true);
+ $this->utilMock->expects($this->any())->method('isMasterKeyEnabled')
+ ->willReturn($isMasterKeyEnabled);
+
if (is_null($uid)) {
$this->keyStorageMock->expects($this->once())
->method('getSystemUserKey')
@@ -389,8 +409,6 @@ class KeyManagerTest extends TestCase {
} else {
$this->keyStorageMock->expects($this->never())
->method('getSystemUserKey');
- $this->utilMock->expects($this->once())->method('isMasterKeyEnabled')
- ->willReturn($isMasterKeyEnabled);
$this->sessionMock->expects($this->once())->method('getPrivateKey')->willReturn($privateKey);
}
@@ -409,23 +427,6 @@ class KeyManagerTest extends TestCase {
}
- public function dataTestGetFileKey() {
- return [
- ['user1', false, 'privateKey', true],
- ['user1', false, false, ''],
- ['user1', true, 'privateKey', true],
- ['user1', true, false, ''],
- ['', false, 'privateKey', true],
- ['', false, false, ''],
- ['', true, 'privateKey', true],
- ['', true, false, ''],
- [null, false, 'privateKey', true],
- [null, false, false, ''],
- [null, true, 'privateKey', true],
- [null, true, false, '']
- ];
- }
-
public function testDeletePrivateKey() {
$this->keyStorageMock->expects($this->once())
->method('deleteUserKey')