From 3dcf085f6441d156d693f54201ef28a4d1c0664d Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Sun, 9 Aug 2026 17:06:15 +0200 Subject: [PATCH] test(OCM): Throw IdentityNotFoundException Signed-off-by: Micke Nordin --- tests/lib/OCM/OCMSignatoryManagerRotationTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib/OCM/OCMSignatoryManagerRotationTest.php b/tests/lib/OCM/OCMSignatoryManagerRotationTest.php index bc3a7f2530c..a8fa92c75c8 100644 --- a/tests/lib/OCM/OCMSignatoryManagerRotationTest.php +++ b/tests/lib/OCM/OCMSignatoryManagerRotationTest.php @@ -19,6 +19,7 @@ use OCP\IAppConfig; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IURLGenerator; +use OCP\Security\Signature\Exceptions\IdentityNotFoundException; use OCP\Security\Signature\ISignatureManager; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; @@ -46,6 +47,8 @@ class OCMSignatoryManagerRotationTest extends TestCase { $this->wireIdentityProofManager(); $signatureManager = $this->createMock(ISignatureManager::class); + $signatureManager->method('generateKeyIdFromConfig') + ->willThrowException(new IdentityNotFoundException('no configured identity')); $urlGenerator = $this->createMock(IURLGenerator::class); $urlGenerator->method('getAbsoluteURL') ->willReturnCallback(static fn (string $path): string => 'https://alice.example' . $path); @@ -188,6 +191,8 @@ class OCMSignatoryManagerRotationTest extends TestCase { // identity at all; provisioning the first key should fail loudly so // the admin gets a clear message instead of a corrupt half-state. $signatureManager = $this->createMock(ISignatureManager::class); + $signatureManager->method('generateKeyIdFromConfig') + ->willThrowException(new IdentityNotFoundException('no configured identity')); $urlGenerator = $this->createMock(IURLGenerator::class); // getAbsoluteURL() yields no host, so the kid's identity cannot be // resolved; provisioning must fail loudly rather than corrupt state.