diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-05 20:55:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 20:55:39 -0500 |
commit | b084ceec3d8635b1e91d9db5e640a3016efc88b2 (patch) | |
tree | 523ad765f8991cc3fe8f50b0e43a029bb926cd37 /build/integration | |
parent | 7d9688c89ed9178bdbedfb9fb38774a73c6e0ffe (diff) | |
parent | 63288ebc501739abb4da657eac49d4165f690dd3 (diff) | |
download | nextcloud-server-b084ceec3d8635b1e91d9db5e640a3016efc88b2.tar.gz nextcloud-server-b084ceec3d8635b1e91d9db5e640a3016efc88b2.zip |
Merge pull request #4224 from nextcloud/dont-list-on-public-calendar-endpoint
Don't list on public calendar endpoints
Diffstat (limited to 'build/integration')
-rw-r--r-- | build/integration/features/bootstrap/CalDavContext.php | 49 | ||||
-rw-r--r-- | build/integration/features/caldav.feature | 9 |
2 files changed, 57 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php index 4843dde135a..8c0348f37a8 100644 --- a/build/integration/features/bootstrap/CalDavContext.php +++ b/build/integration/features/bootstrap/CalDavContext.php @@ -89,7 +89,7 @@ class CalDavContext implements \Behat\Behat\Context\Context { 'auth' => [ $user, $password, - ] + ], ] ); $this->response = $this->client->send($request); @@ -184,4 +184,51 @@ class CalDavContext implements \Behat\Behat\Context\Context { $this->response = $this->client->send($request); } + /** + * @Then :user publicly shares the calendar named :name + * + * @param string $user + * @param string $name + */ + public function publiclySharesTheCalendarNamed($user, $name) { + $davUrl = $this->baseUrl . '/remote.php/dav/calendars/'.$user.'/'.$name; + $password = ($user === 'admin') ? 'admin' : '123456'; + + $request = $this->client->createRequest( + 'POST', + $davUrl, + [ + 'body' => '<cs:publish-calendar xmlns:cs="http://calendarserver.org/ns/"/>', + 'auth' => [ + $user, + $password, + ], + 'headers' => [ + 'Content-Type' => 'application/xml; charset=UTF-8', + ], + ] + ); + + $this->response = $this->client->send($request); + } + + /** + * @Then There should be :amount calendars in the response body + * + * @param string $amount + */ + public function t($amount) { + $jsonEncoded = json_encode($this->responseXml); + $arrayElement = json_decode($jsonEncoded, true); + $actual = count($arrayElement['value']) - 1; + if($actual !== (int)$amount) { + throw new InvalidArgumentException( + sprintf( + 'Expected %s got %s', + $amount, + $actual + ) + ); + } + } } diff --git a/build/integration/features/caldav.feature b/build/integration/features/caldav.feature index 5c3983fc40b..2bddbc3e9e4 100644 --- a/build/integration/features/caldav.feature +++ b/build/integration/features/caldav.feature @@ -50,3 +50,12 @@ Feature: caldav Then The CalDAV HTTP status code should be "201" And "admin" requests calendar "admin/MyCalendar" on the endpoint "/remote.php/dav/calendars/" Then The CalDAV HTTP status code should be "207" + + Scenario: Propfind on public calendar endpoint without calendars + When "admin" creates a calendar named "MyCalendar" + Then The CalDAV HTTP status code should be "201" + And "admin" publicly shares the calendar named "MyCalendar" + Then The CalDAV HTTP status code should be "202" + When "admin" requests calendar "/" on the endpoint "/remote.php/dav/public-calendars" + Then The CalDAV HTTP status code should be "207" + Then There should be "0" calendars in the response body
\ No newline at end of file |