Skip to content

Commit ebf36ba

Browse files
committed
test(integration): write integration tests for calendar delegation
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
1 parent d0547b3 commit ebf36ba

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
@@ -409,19 +409,23 @@ public function updatesHrefPropertyOfPrincipal(
409409
$xml = new \Sabre\Xml\Service();
410410
$body = $xml->write('{DAV:}propertyupdate', $propPatch, '/');
411411

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

0 commit comments

Comments
 (0)