Skip to content

Commit b3d4c14

Browse files
committed
test: adjust tests to caching of key validation
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 0252ed0 commit b3d4c14

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

apps/encryption/tests/EncryptedStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OC\Files\Storage\Temporary;
1212
use OC\Files\Storage\Wrapper\Encryption;
1313
use OC\Files\View;
14+
use OCA\Encryption\KeyManager;
1415
use OCP\Files\Mount\IMountManager;
1516
use OCP\Files\Storage\IDisableEncryptionStorage;
1617
use OCP\Server;
@@ -30,6 +31,8 @@ class EncryptedStorageTest extends TestCase {
3031
use UserTrait;
3132

3233
public function testMoveFromEncrypted(): void {
34+
Server::get(KeyManager::class)->validateMasterKey();
35+
Server::get(KeyManager::class)->validateShareKey();
3336
$this->createUser('test1', 'test2');
3437
$this->setupForUser('test1', 'test2');
3538

apps/encryption/tests/Users/SetupTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use OCA\Encryption\Crypto\Crypt;
1313
use OCA\Encryption\KeyManager;
1414
use OCA\Encryption\Users\Setup;
15+
use OCP\ICache;
16+
use OCP\ICacheFactory;
1517
use PHPUnit\Framework\MockObject\MockObject;
1618
use Test\TestCase;
1719

@@ -32,9 +34,16 @@ protected function setUp(): void {
3234
->disableOriginalConstructor()
3335
->getMock();
3436

37+
$cache = $this->createMock(ICache::class);
38+
$cacheFactory = $this->createMock(ICacheFactory::class);
39+
$cacheFactory->method('createLocal')
40+
->willReturn($cache);
41+
3542
$this->instance = new Setup(
3643
$this->cryptMock,
37-
$this->keyManagerMock);
44+
$this->keyManagerMock,
45+
$cacheFactory,
46+
);
3847
}
3948

4049

0 commit comments

Comments
 (0)