From 2247d3354288ad0ed31e053d86bdb456b483b790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 8 Apr 2016 17:06:53 +0200 Subject: [PATCH] Integration test for a disabled user --- .../features/bootstrap/Provisioning.php | 16 +++++++++++++++- build/integration/features/bootstrap/WebDav.php | 10 ++++++++++ .../integration/features/webdav-related.feature | 8 ++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index feeb850ae7d3..ff090f5abb83 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -35,7 +35,6 @@ public function assureUserExists($user) { } $this->userExists($user); PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); - } /** @@ -230,6 +229,20 @@ public function creatingTheGroup($group) { } } + /** + * @When /^user "([^"]*)" is disabled$/ + */ + public function userIsDisabled($user) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user/disable"; + $client = new Client(); + $options = []; + if ($this->currentUser === 'admin') { + $options['auth'] = $this->adminUser; + } + + $this->response = $client->send($client->createRequest("PUT", $fullUrl, $options)); + } + /** * @When /^Deleting the user "([^"]*)"$/ * @param string $user @@ -588,4 +601,5 @@ public function cleanupGroups() } $this->usingServer($previousServer); } + } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 0ca2a411c751..684761dadcf5 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -405,5 +405,15 @@ public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest) } + /** + * @Given /^Downloading file "([^"]*)" as "([^"]*)"$/ + */ + public function downloadingFileAs($fileName, $user) { + try { + $this->response = $this->makeDavRequest($user, 'GET', $fileName, []); + } catch (\GuzzleHttp\Exception\ServerException $ex) { + $this->response = $ex->getResponse(); + } + } } diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 6fc437773c64..e7b0d491d0ad 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -277,3 +277,11 @@ Feature: webdav-related When As an "user0" And Downloading file "/files/user0/myChunkedFile.txt" Then Downloaded content should be "AAAAABBBBBCCCCC" + + Scenario: A disabled user cannot use webdav + Given user "userToBeDisabled" exists + And As an "admin" + And user "userToBeDisabled" is disabled + When Downloading file "/welcome.txt" as "userToBeDisabled" + Then the HTTP status code should be "503" +