apiTests: add test share Space with role
This commit is contained in:
@@ -1235,11 +1235,12 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" shares a space "([^"]*)" to user "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" shares a space "([^"]*)" to user "([^"]*)" with role "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string $userRecipient
|
||||
* @param string $role
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
@@ -1247,10 +1248,26 @@ class SpacesContext implements Context {
|
||||
public function sendShareSpaceRequest(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $userRecipient
|
||||
string $userRecipient,
|
||||
string $role
|
||||
): void {
|
||||
switch ($role) {
|
||||
case "viewer":
|
||||
$role = 1;
|
||||
break;
|
||||
case "editor":
|
||||
$role = 15;
|
||||
break;
|
||||
default:
|
||||
$role = 1;
|
||||
}
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$body = ["space_ref" => $space['id'], "shareType" => 7, "shareWith" => $userRecipient];
|
||||
$body = [
|
||||
"space_ref" => $space['id'],
|
||||
"shareType" => 7,
|
||||
"shareWith" => $userRecipient,
|
||||
"permissions" => $role
|
||||
];
|
||||
|
||||
$fullUrl = $this->baseUrl . "/ocs/v2.php/apps/files_sharing/api/v1/shares";
|
||||
|
||||
@@ -1267,11 +1284,12 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has shared a space "([^"]*)" to user "([^"]*)"$/
|
||||
* @Given /^user "([^"]*)" has shared a space "([^"]*)" to user "([^"]*)" with role "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string $userRecipient
|
||||
* @param string $role
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
@@ -1279,9 +1297,10 @@ class SpacesContext implements Context {
|
||||
public function userHasSharedSpace(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $userRecipient
|
||||
string $userRecipient,
|
||||
string $role
|
||||
): void {
|
||||
$this->sendShareSpaceRequest($user, $spaceName, $userRecipient);
|
||||
$this->sendShareSpaceRequest($user, $spaceName, $userRecipient, $role);
|
||||
|
||||
$expectedHTTPStatus = "200";
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
|
||||
Reference in New Issue
Block a user