Browse Source

chore(tests): Adapt encryption tests to code changes

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/54316/head
Côme Chilliet 11 months ago
parent
commit
7ac0856f9f
No known key found for this signature in database GPG Key ID: A3E2F658B28C760A
  1. 2
      apps/encryption/tests/Crypto/EncryptionTest.php
  2. 12
      apps/encryption/tests/KeyManagerTest.php

2
apps/encryption/tests/Crypto/EncryptionTest.php

@ -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', [], []);

12
apps/encryption/tests/KeyManagerTest.php

@ -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…
Cancel
Save