Skip to content

Commit

Permalink
test: fix redis not being used properly in imapClientFactoryTest
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
st3iny committed Aug 31, 2024
1 parent 45f2854 commit f4e1536
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Integration/IMAP/IMAPClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use OCA\Mail\Db\MailAccount;
use OCA\Mail\IMAP\HordeImapClient;
use OCA\Mail\IMAP\IMAPClientFactory;
use OCA\Mail\Tests\Integration\Framework\Caching;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
Expand Down Expand Up @@ -110,13 +111,21 @@ public function testRateLimiting(): void {
if (ltrim($cacheClass, '\\') !== Redis::class) {
$this->markTestSkipped('Redis not available. Found ' . $cacheClass);
}

[$imapClientFactory, $cacheFactory] = Caching::getImapClientFactoryAndConfiguredCacheFactory($this->crypto);
$this->assertInstanceOf(
Redis::class,
$cacheFactory->createDistributed(),
'Distributed cache is not Redis',
);

$account = $this->getTestAccount();
$this->crypto->expects($this->once())
->method('decrypt')
->with('encrypted')
->willReturn('notmypassword');

$client = $this->factory->getClient($account);
$client = $imapClientFactory->getClient($account);
self::assertInstanceOf(HordeImapClient::class, $client);
foreach ([1, 2, 3] as $attempts) {
try {
Expand Down

0 comments on commit f4e1536

Please sign in to comment.