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
44098add66
commit
427c6b2483
3 changed files with 16 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ namespace OCA\Encryption\Tests\Command;
|
|||
use OC\Files\SetupManager;
|
||||
use OC\Files\View;
|
||||
use OCA\Encryption\Command\FixEncryptedVersion;
|
||||
use OCA\Encryption\KeyManager;
|
||||
use OCA\Encryption\Util;
|
||||
use OCP\Encryption\IManager;
|
||||
use OCP\IAppConfig;
|
||||
|
|
@ -49,6 +50,8 @@ class FixEncryptedVersionTest extends TestCase {
|
|||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
Server::get(KeyManager::class)->validateMasterKey();
|
||||
Server::get(KeyManager::class)->validateShareKey();
|
||||
|
||||
Server::get(IAppConfig::class)->setValueBool('encryption', 'useMasterKey', true);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -30,6 +31,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