mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
chore(tests): Adapt encryption tests to code changes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
b74c7538ac
commit
7ac0856f9f
2 changed files with 4 additions and 10 deletions
|
|
@ -232,7 +232,7 @@ class EncryptionTest extends TestCase {
|
|||
->willReturn(true);
|
||||
$this->keyManagerMock->expects($this->once())
|
||||
->method('getFileKey')
|
||||
->with($path, 'user', null, true)
|
||||
->with($path, null, null, true)
|
||||
->willReturn($fileKey);
|
||||
|
||||
$this->instance->begin($path, 'user', 'r', [], []);
|
||||
|
|
|
|||
|
|
@ -352,15 +352,8 @@ class KeyManagerTest extends TestCase {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $uid
|
||||
* @param $isMasterKeyEnabled
|
||||
* @param $privateKey
|
||||
* @param $expected
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')]
|
||||
public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected): void {
|
||||
public function testGetFileKey(?string $uid, bool $isMasterKeyEnabled, string|false $privateKey, string $encryptedFileKey, string $expected): void {
|
||||
$path = '/foo.txt';
|
||||
|
||||
if ($isMasterKeyEnabled) {
|
||||
|
|
@ -374,6 +367,7 @@ class KeyManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
$this->invokePrivate($this->instance, 'masterKeyId', ['masterKeyId']);
|
||||
$this->invokePrivate($this->instance, 'keyUid', [$uid]);
|
||||
|
||||
$this->keyStorageMock->expects($this->exactly(2))
|
||||
->method('getFileKey')
|
||||
|
|
@ -423,7 +417,7 @@ class KeyManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
$this->assertSame($expected,
|
||||
$this->instance->getFileKey($path, $uid, null)
|
||||
$this->instance->getFileKey($path, null, null)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue