|
|
|
|
@ -304,7 +304,6 @@ class EncryptionTest extends TestCase { |
|
|
|
|
$this->assertSame($expected, |
|
|
|
|
$this->instance->update('path', 'user1', ['users' => ['user1']]) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function dataTestUpdate() { |
|
|
|
|
@ -330,6 +329,43 @@ class EncryptionTest extends TestCase { |
|
|
|
|
$this->instance->update('path', 'user1', []); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Test case if the public key is missing. ownCloud should still encrypt |
|
|
|
|
* the file for the remaining users |
|
|
|
|
*/ |
|
|
|
|
public function testUpdateMissingPublicKey() { |
|
|
|
|
$this->keyManagerMock->expects($this->once()) |
|
|
|
|
->method('getFileKey')->willReturn('fileKey'); |
|
|
|
|
|
|
|
|
|
$this->keyManagerMock->expects($this->any()) |
|
|
|
|
->method('getPublicKey')->willReturnCallback( |
|
|
|
|
function($user) { |
|
|
|
|
throw new PublicKeyMissingException($user); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->keyManagerMock->expects($this->any()) |
|
|
|
|
->method('addSystemKeys') |
|
|
|
|
->willReturnCallback(function($accessList, $publicKeys) { |
|
|
|
|
return $publicKeys; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$this->cryptMock->expects($this->once())->method('multiKeyEncrypt') |
|
|
|
|
->willReturnCallback( |
|
|
|
|
function($fileKey, $publicKeys) { |
|
|
|
|
$this->assertEmpty($publicKeys); |
|
|
|
|
$this->assertSame('fileKey', $fileKey); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->keyManagerMock->expects($this->never())->method('getVersion'); |
|
|
|
|
$this->keyManagerMock->expects($this->never())->method('setVersion'); |
|
|
|
|
|
|
|
|
|
$this->assertTrue( |
|
|
|
|
$this->instance->update('path', 'user1', ['users' => ['user1']]) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* by default the encryption module should encrypt regular files, files in |
|
|
|
|
* files_versions and files in files_trashbin |
|
|
|
|
|