[tests-only][full-ci]Added test to update role and expiration date for share link (v1beta1) (#8071)

* Added test to update role and expiration date for share link

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

* Review address

---------

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
Sagar Gurung
2024-01-02 16:53:47 +05:45
committed by GitHub
parent a3a9757c48
commit 6e9b599195
5 changed files with 321 additions and 20 deletions

View File

@@ -75,6 +75,11 @@ trait Sharing {
*/
private array $createdPublicShares = [];
/**
* @var array
*/
private array $shareNgCreatedLinkShares = [];
/**
* @return string
*/
@@ -98,6 +103,22 @@ trait Sharing {
$this->createdPublicShares[] = $shareData;
}
/**
* @param ResponseInterface $response
*
* @return void
*/
public function shareNgAddToCreatedLinkShares(ResponseInterface $response): void {
$this->shareNgCreatedLinkShares[] = $response;
}
/**
* @return ResponseInterface|null
*/
public function shareNgGetLastCreatedLinkShare():?ResponseInterface {
return \end($this->shareNgCreatedLinkShares);
}
/**
* @param string $sharer
* @param SimpleXMLElement $shareData
@@ -152,6 +173,17 @@ trait Sharing {
return "/apps/files_sharing/api/v$this->sharingApiVersion/shares$postfix";
}
/**
* @return string
*/
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');
}
return $this->getJsonDecodedResponse($lastResponse)['id'];
}
/**
* Split given permissions string each separated with "," into array of strings
*