[tests-only] tests: add tests for removing share permission (#8130)

* tests: add tests for removing share permission

* tests: add tests for removing share permission in group share

* tests: refactor test script for removing permission from share

* address reviews

---------

Co-authored-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Swikriti Tripathi
2024-01-11 11:31:28 +05:45
committed by GitHub
co-authored by Saw-jan
parent 73d9ace439
commit 3976c1c1fc
4 changed files with 283 additions and 18 deletions
@@ -80,6 +80,11 @@ trait Sharing {
*/
private array $shareNgCreatedLinkShares = [];
/**
* @var array
*/
private array $shareNgCreatedUserGroupShares = [];
/**
* @return string
*/
@@ -119,6 +124,22 @@ trait Sharing {
return \end($this->shareNgCreatedLinkShares);
}
/**
* @param ResponseInterface $response
*
* @return void
*/
public function shareNgAddToCreatedUserGroupShares(ResponseInterface $response): void {
$this->shareNgCreatedUserGroupShares[] = $response;
}
/**
* @return ResponseInterface|null
*/
public function shareNgGetLastCreatedUserGroupShare():?ResponseInterface {
return \end($this->shareNgCreatedUserGroupShares);
}
/**
* @param string $sharer
* @param SimpleXMLElement $shareData
@@ -179,7 +200,7 @@ trait Sharing {
public function shareNgGetLastCreatedLinkShareID(): string {
$lastResponse = $this->shareNgGetLastCreatedLinkShare();
if (!isset($this->getJsonDecodedResponse($lastResponse)['id'])) {
throw new Error('Response did not contain share id ' . $this->getJsonDecodedResponse($lastResponse)['id'] . ' for the created public link');
throw new Error('Response did not contain share id for the created public link');
}
return $this->getJsonDecodedResponse($lastResponse)['id'];
}
@@ -196,6 +217,17 @@ trait Sharing {
return substr(strrchr($last_created_link_webURL, "/"), 1);
}
/**
* @return string
*/
public function shareNgGetLastCreatedUserGroupShareID(): string {
$lastResponse = $this->shareNgGetLastCreatedUserGroupShare();
if (!isset($this->getJsonDecodedResponse($lastResponse)['value'][0]['id'])) {
throw new Error('Response did not contain share id for the last created share.');
}
return $this->getJsonDecodedResponse($lastResponse)['value'][0]['id'];
}
/**
* Split given permissions string each separated with "," into array of strings
*