[tests-only] tests: refactor test script for removing permission from share (#8134)

* 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-09 13:56:32 +05:45
committed by GitHub
co-authored by Saw-jan
parent c3f755437a
commit 954a1c04a0
3 changed files with 41 additions and 55 deletions
@@ -152,7 +152,7 @@ class SharingNgContext implements Context {
$permission = $rows['permission'] ?? null;
$expireDate = $rows["expireDate"] ?? null;
return GraphHelper::sendSharingInvitation(
$response = GraphHelper::sendSharingInvitation(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
@@ -165,6 +165,10 @@ class SharingNgContext implements Context {
$permission,
$expireDate
);
if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
}
return $response;
}
/**
@@ -351,21 +355,9 @@ class SharingNgContext implements Context {
$itemId = ($resourceType === 'folder')
? $this->spacesContext->getResourceId($sharer, $space, $resource)
: $this->spacesContext->getFileId($sharer, $space, $resource);
$userIdOfSharee = ($shareType === 'user')
? $this->featureContext->getUserIdByUserName($sharee)
: $this->featureContext->getGroupIdByGroupName($sharee);
$permId = GraphHelper::getSharePermissionId(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$sharer,
$userIdOfSharee,
$this->featureContext->getPasswordForUser($sharer),
$spaceId,
$itemId,
$shareType
);
$permId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$this->featureContext->setResponse(
GraphHelper::removeSharePermission(
GraphHelper::deleteSharePermission(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$sharer,