summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2016-02-10 12:34:55 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2016-02-10 13:27:32 +0100
commit9dc759b4dc02f565ff18bc14f13e0b00da0ee05c (patch)
treeef10a5d9219db8c58a63e7bf3d6bb8ac9dcc2a1d /apps/encryption/tests
parent43ed86313ca3e8f6820dc08c38c9d4a7c32ddf01 (diff)
downloadnextcloud-server-9dc759b4dc02f565ff18bc14f13e0b00da0ee05c.tar.gz
nextcloud-server-9dc759b4dc02f565ff18bc14f13e0b00da0ee05c.zip
remember signature version and only set it on update to make sure that other
apps like files_versions still get the old signature version
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/lib/crypto/encryptionTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/lib/crypto/encryptionTest.php
index ad943ab6e49..0ce1a2cb76a 100644
--- a/apps/encryption/tests/lib/crypto/encryptionTest.php
+++ b/apps/encryption/tests/lib/crypto/encryptionTest.php
@@ -298,6 +298,9 @@ class EncryptionTest extends TestCase {
return $publicKeys;
});
+ $this->keyManagerMock->expects($this->never())->method('getVersion');
+ $this->keyManagerMock->expects($this->never())->method('setVersion');
+
$this->assertSame($expected,
$this->instance->update('path', 'user1', ['users' => ['user1']])
);
@@ -311,6 +314,22 @@ class EncryptionTest extends TestCase {
);
}
+ public function testUpdateNoUsers() {
+
+ $this->invokePrivate($this->instance, 'rememberVersion', [['path' => 2]]);
+
+ $this->keyManagerMock->expects($this->never())->method('getFileKey');
+ $this->keyManagerMock->expects($this->never())->method('getPublicKey');
+ $this->keyManagerMock->expects($this->never())->method('addSystemKeys');
+ $this->keyManagerMock->expects($this->once())->method('setVersion')
+ ->willReturnCallback(function($path, $version, $view) {
+ $this->assertSame('path', $path);
+ $this->assertSame(2, $version);
+ $this->assertTrue($view instanceof \OC\Files\View);
+ });
+ $this->instance->update('path', 'user1', []);
+ }
+
/**
* by default the encryption module should encrypt regular files, files in
* files_versions and files in files_trashbin