Skip to content

Commit e750915

Browse files
hamza221backportbot[bot]
authored andcommitted
test(integration): write integration tests for calendar delegation
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
1 parent d61d47f commit e750915

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

build/integration/dav_features/caldav-delegation.feature

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ Feature: calendar delegation
2020
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/"
2121
Then The CalDAV response should be multi status
2222
And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-write"
23-
And The CalDAV response should contain a property "{DAV:}group-member-set"
23+
And The CalDAV response should contain a property "{DAV:}group-member-set"
24+
25+
Scenario: Admin cannot grant User1 access to User0's calendar account
26+
Given user "admin" exists
27+
And user "user0" exists
28+
And user "user1" exists
29+
When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user1" of principal "users/user0/calendar-proxy-write" on the endpoint "/remote.php/dav/principals/"
30+
Then The CalDAV HTTP status code should be "404"

build/integration/features/bootstrap/CalDavContext.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,23 @@ public function updatesHrefPropertyOfPrincipal(
410410
$xml = new \Sabre\Xml\Service();
411411
$body = $xml->write('{DAV:}propertyupdate', $propPatch, '/');
412412

413-
$this->response = $this->client->request(
414-
'PROPPATCH',
415-
$davUrl,
416-
[
417-
'headers' => [
418-
'Content-Type' => 'application/xml; charset=UTF-8',
419-
],
420-
'body' => $body,
421-
'auth' => [
422-
$user,
423-
$password,
424-
],
425-
]
426-
);
413+
try {
414+
$this->response = $this->client->request(
415+
'PROPPATCH',
416+
$davUrl,
417+
[
418+
'headers' => [
419+
'Content-Type' => 'application/xml; charset=UTF-8',
420+
],
421+
'body' => $body,
422+
'auth' => [
423+
$user,
424+
$password,
425+
],
426+
]
427+
);
428+
} catch (\GuzzleHttp\Exception\ClientException $e) {
429+
$this->response = $e->getResponse();
430+
}
427431
}
428432
}

0 commit comments

Comments
 (0)