Skip to content

Commit 3dcf085

Browse files
committed
test(OCM): Throw IdentityNotFoundException
Signed-off-by: Micke Nordin <kano@sunet.se>
1 parent 41cc0a4 commit 3dcf085

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/lib/OCM/OCMSignatoryManagerRotationTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use OCP\ICacheFactory;
2020
use OCP\IConfig;
2121
use OCP\IURLGenerator;
22+
use OCP\Security\Signature\Exceptions\IdentityNotFoundException;
2223
use OCP\Security\Signature\ISignatureManager;
2324
use PHPUnit\Framework\MockObject\MockObject;
2425
use Psr\Log\LoggerInterface;
@@ -46,6 +47,8 @@ protected function setUp(): void {
4647
$this->wireIdentityProofManager();
4748

4849
$signatureManager = $this->createMock(ISignatureManager::class);
50+
$signatureManager->method('generateKeyIdFromConfig')
51+
->willThrowException(new IdentityNotFoundException('no configured identity'));
4952
$urlGenerator = $this->createMock(IURLGenerator::class);
5053
$urlGenerator->method('getAbsoluteURL')
5154
->willReturnCallback(static fn (string $path): string => 'https://alice.example' . $path);
@@ -188,6 +191,8 @@ public function testSignerReturnsNullWhenIdentityCannotBeDerived(): void {
188191
// identity at all; provisioning the first key should fail loudly so
189192
// the admin gets a clear message instead of a corrupt half-state.
190193
$signatureManager = $this->createMock(ISignatureManager::class);
194+
$signatureManager->method('generateKeyIdFromConfig')
195+
->willThrowException(new IdentityNotFoundException('no configured identity'));
191196
$urlGenerator = $this->createMock(IURLGenerator::class);
192197
// getAbsoluteURL() yields no host, so the kid's identity cannot be
193198
// resolved; provisioning must fail loudly rather than corrupt state.

0 commit comments

Comments
 (0)