summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorSergio Bertolin <sbertolin@solidgear.es>2015-11-06 10:16:34 +0000
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-06 11:57:02 +0100
commite34872141e3e1e2e20404dcfce4a08589798ff68 (patch)
tree07b84578f97b6068efbac7ed6223abd8f9e6fe13 /build
parentdc96aa384921dab74ea3aea07cbf016f8bd0681f (diff)
downloadnextcloud-server-e34872141e3e1e2e20404dcfce4a08589798ff68.tar.gz
nextcloud-server-e34872141e3e1e2e20404dcfce4a08589798ff68.zip
Added tests about getting shares of a file and a test for deleting a user from a group which doesn't exist
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/FeatureContext.php23
-rw-r--r--build/integration/features/provisioning-v1.feature8
-rw-r--r--build/integration/features/sharing-v1.feature30
3 files changed, 58 insertions, 3 deletions
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php
index 93073263d88..69fa018d0e6 100644
--- a/build/integration/features/bootstrap/FeatureContext.php
+++ b/build/integration/features/bootstrap/FeatureContext.php
@@ -24,6 +24,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/** @var int */
private $apiVersion = 1;
+ /** @var int */
+ private $sharingApiVersion = 1;
+
/** @var SimpleXMLElement */
private $lastShareData = null;
@@ -605,7 +608,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
*/
public function addingExpirationDate() {
$share_id = $this->lastShareData->data[0]->id;
- $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->apiVersion}/shares/$share_id";
+ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id";
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
@@ -626,7 +629,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$publicUpload = null,
$password = null,
$permissions = null){
- $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->apiVersion}/shares";
+ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares";
$client = new Client();
$options = [];
@@ -690,6 +693,20 @@ class FeatureContext implements Context, SnippetAcceptingContext {
PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('file_target', "/$filename"));
}
+ /**
+ * @Then /^User "([^"]*)" should be included in the response$/
+ */
+ public function checkSharedUserInResponse($user){
+ PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse('share_with', "$user"));
+ }
+
+ /**
+ * @Then /^User "([^"]*)" should not be included in the response$/
+ */
+ public function checkSharedUserNotInResponse($user){
+ PHPUnit_Framework_Assert::assertEquals(False, $this->isFieldInResponse('share_with', "$user"));
+ }
+
public function isUserInSharedData($user){
$data = $this->response->xml()->data[0];
foreach($data as $element) {
@@ -704,7 +721,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @Given /^file "([^"]*)" from user "([^"]*)" is shared with user "([^"]*)"$/
*/
public function assureFileIsShared($filepath, $user1, $user2){
- $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->apiVersion}/shares" . "?path=$filepath";
+ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares" . "?path=$filepath";
$client = new Client();
$options = [];
if ($user1 === 'admin') {
diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature
index 91050e82c28..2a3e8e07fc4 100644
--- a/build/integration/features/provisioning-v1.feature
+++ b/build/integration/features/provisioning-v1.feature
@@ -159,6 +159,14 @@ Feature: provisioning
And the OCS status code should be "100"
And the HTTP status code should be "200"
+ Scenario: removing a user from a group which doesn't exists
+ Given As an "admin"
+ And user "brand-new-user" exists
+ And group "not-group" does not exist
+ When sending "DELETE" to "/cloud/users/brand-new-user/groups" with
+ | groupid | not-group |
+ Then the OCS status code should be "102"
+
Scenario: removing a user from a group
Given As an "admin"
And user "brand-new-user" exists
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 8bdfd722652..b73fb39d5da 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -78,6 +78,36 @@ Feature: sharing
And the HTTP status code should be "200"
And File "textfile0.txt" should not be included in the response
+ Scenario: getting all shares of a file
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And user "user3" exists
+ And file "textfile0.txt" from user "user0" is shared with user "user1"
+ And file "textfile0.txt" from user "user0" is shared with user "user2"
+ And As an "user0"
+ When sending "GET" to "/apps/files_sharing/api/v1/shares?path=textfile0.txt"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And User "user1" should be included in the response
+ And User "user2" should be included in the response
+ And User "user3" should not be included in the response
+
+ Scenario: getting all shares of a file with reshares
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And user "user3" exists
+ And file "textfile0.txt" from user "user0" is shared with user "user1"
+ And file "textfile0.txt" from user "user1" is shared with user "user2"
+ And As an "user0"
+ When sending "GET" to "/apps/files_sharing/api/v1/shares?reshares=true&path=textfile0.txt"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And User "user1" should be included in the response
+ And User "user2" should be included in the response
+ And User "user3" should not be included in the response
+
Scenario: delete a share
Given user "user0" exists
And user "user1" exists