Skip to content

Commit aade4ed

Browse files
committed
test(integration): add tests for calendar delegation
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
1 parent 89b06a4 commit aade4ed

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
Feature: calendar delegation
4+
Calendar delegation grants another user/principal control of a calendar account,
5+
including all calendars the delegator can access.
6+
7+
Scenario: admin grants user0 read access to her calendar account
8+
Given user "admin" exists
9+
And user "user0" exists
10+
When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user0" of principal "users/admin/calendar-proxy-read" on the endpoint "/remote.php/dav/principals/"
11+
Then The CalDAV response should be multi status
12+
And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-read"
13+
And The CalDAV response should contain a property "{DAV:}group-member-set"
14+
15+
Scenario: admin grants write access to her calendar account
16+
Given user "admin" exists
17+
And user "user0" exists
18+
When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user0" of principal "users/admin/calendar-proxy-write" on the endpoint "/remote.php/dav/principals/"
19+
Then The CalDAV response should be multi status
20+
And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-write"
21+
And The CalDAV response should contain a property "{DAV:}group-member-set"

build/integration/features/bootstrap/CalDavContext.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ public function theCaldavResponseShouldContainAPropertyWithHrefValue(
172172
}
173173
}
174174

175+
/**
176+
* @Then The CalDAV response should contain an href :href
177+
* @throws \Exception
178+
*/
179+
public function theCaldavResponseShouldContainAnHref(string $href): void {
180+
/** @var \Sabre\DAV\Xml\Response\MultiStatus $multiStatus */
181+
$multiStatus = $this->responseXml['value'];
182+
foreach ($multiStatus->getResponses() as $response) {
183+
if ($response->getHref() === $href) {
184+
return;
185+
}
186+
}
187+
throw new \Exception(
188+
sprintf(
189+
'Expected href %s not found in response',
190+
$href,
191+
)
192+
);
193+
}
194+
175195
/**
176196
* @Then The CalDAV response should be multi status
177197
* @throws \Exception

0 commit comments

Comments
 (0)