summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-08 17:06:53 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-05-02 09:31:22 +0200
commit0eed6b518967868f7837225be1db0f698c09b685 (patch)
treefe3b02cfd4c2bf8b2b977ed17671cd38f526663b /build
parent8486926a147ad767d2ac8957512142f8a4873fa7 (diff)
downloadnextcloud-server-0eed6b518967868f7837225be1db0f698c09b685.tar.gz
nextcloud-server-0eed6b518967868f7837225be1db0f698c09b685.zip
Integration test for a disabled user
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/Provisioning.php16
-rw-r--r--build/integration/features/bootstrap/WebDav.php10
-rw-r--r--build/integration/features/webdav-related.feature8
3 files changed, 33 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index feeb850ae7d..ff090f5abb8 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -35,7 +35,6 @@ trait Provisioning {
}
$this->userExists($user);
PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
-
}
/**
@@ -231,6 +230,20 @@ trait Provisioning {
}
/**
+ * @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 @@ trait Provisioning {
}
$this->usingServer($previousServer);
}
+
}
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 79c447ac573..cd9584ad186 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -424,5 +424,15 @@ trait WebDav {
}
+ /**
+ * @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 abdc63935e9..f2343b6254f 100644
--- a/build/integration/features/webdav-related.feature
+++ b/build/integration/features/webdav-related.feature
@@ -286,3 +286,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"
+