mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test: adjust tests to caching of key validation
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
00d9a2eccb
commit
e1e5671a07
3 changed files with 16 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ namespace OCA\Encryption\Tests\Command;
|
|||
|
||||
use OC\Files\View;
|
||||
use OCA\Encryption\Command\FixEncryptedVersion;
|
||||
use OCA\Encryption\KeyManager;
|
||||
use OCA\Encryption\Util;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\IConfig;
|
||||
|
|
@ -47,6 +48,8 @@ class FixEncryptedVersionTest extends TestCase {
|
|||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
Server::get(KeyManager::class)->validateMasterKey();
|
||||
Server::get(KeyManager::class)->validateShareKey();
|
||||
|
||||
Server::get(IConfig::class)->setAppValue('encryption', 'useMasterKey', '1');
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace OCA\encryption\tests;
|
|||
use OC\Files\Storage\Temporary;
|
||||
use OC\Files\Storage\Wrapper\Encryption;
|
||||
use OC\Files\View;
|
||||
use OCA\Encryption\KeyManager;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Storage\IDisableEncryptionStorage;
|
||||
use OCP\Server;
|
||||
|
|
@ -32,6 +33,8 @@ class EncryptedStorageTest extends TestCase {
|
|||
use UserTrait;
|
||||
|
||||
public function testMoveFromEncrypted(): void {
|
||||
Server::get(KeyManager::class)->validateMasterKey();
|
||||
Server::get(KeyManager::class)->validateShareKey();
|
||||
$this->createUser('test1', 'test2');
|
||||
$this->setupForUser('test1', 'test2');
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ namespace OCA\Encryption\Tests\Users;
|
|||
use OCA\Encryption\Crypto\Crypt;
|
||||
use OCA\Encryption\KeyManager;
|
||||
use OCA\Encryption\Users\Setup;
|
||||
use OCP\ICache;
|
||||
use OCP\ICacheFactory;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Test\TestCase;
|
||||
|
||||
|
|
@ -32,9 +34,16 @@ class SetupTest extends TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$cache = $this->createMock(ICache::class);
|
||||
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||
$cacheFactory->method('createLocal')
|
||||
->willReturn($cache);
|
||||
|
||||
$this->instance = new Setup(
|
||||
$this->cryptMock,
|
||||
$this->keyManagerMock);
|
||||
$this->keyManagerMock,
|
||||
$cacheFactory,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue