瀏覽代碼

test(dav): Add unit test for no calendars/subscription limit

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v29.0.0beta2
Christoph Wurst 2 月之前
父節點
當前提交
1e8238b9e4
No account linked to committer's email address
共有 1 個文件被更改,包括 38 次插入0 次删除
  1. 38
    0
      apps/dav/tests/unit/CalDAV/Security/RateLimitingPluginTest.php

+ 38
- 0
apps/dav/tests/unit/CalDAV/Security/RateLimitingPluginTest.php 查看文件

@@ -163,4 +163,42 @@ class RateLimitingPluginTest extends TestCase {
$this->plugin->beforeBind('calendars/foo/cal');
}

public function testNoCalendarsSubscriptsLimit(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects(self::once())
->method('get')
->with($this->userId)
->willReturn($user);
$user->method('getUID')->willReturn('user123');
$this->config
->method('getValueInt')
->with('dav')
->willReturnCallback(function ($app, $key, $default) {
switch ($key) {
case 'maximumCalendarsSubscriptions':
return -1;
default:
return $default;
}
});
$this->limiter->expects(self::once())
->method('registerUserRequest')
->with(
'caldav-create-calendar',
10,
3600,
$user,
);
$this->caldavBackend->expects(self::never())
->method('getCalendarsForUserCount')
->with('principals/users/user123')
->willReturn(27);
$this->caldavBackend->expects(self::never())
->method('getSubscriptionsForUserCount')
->with('principals/users/user123')
->willReturn(3);

$this->plugin->beforeBind('calendars/foo/cal');
}

}

Loading…
取消
儲存