summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-04-05 22:43:05 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-04-05 22:43:05 +0200
commit63288ebc501739abb4da657eac49d4165f690dd3 (patch)
tree74203bb3d18dfe3c9ef1ee5fbe812aa35042c370 /build
parent00558de782e93d2f5b7d73c0197fdf38261003f9 (diff)
downloadnextcloud-server-63288ebc501739abb4da657eac49d4165f690dd3.tar.gz
nextcloud-server-63288ebc501739abb4da657eac49d4165f690dd3.zip
Don't list on public calendar endpoints
There is no need to allow listing here. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/CalDavContext.php49
-rw-r--r--build/integration/features/caldav.feature9
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