Merge pull request #20351 from owncloud/sharing-api-integration-tests-getting-shares
Added tests about getting shares of a file and a test for deleting a …
This commit is contained in:
commit
37c5edc202
3 changed files with 58 additions and 3 deletions
|
@ -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') {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue