[tests-only][full-ci]Added tests to lists shared by me after sharee is deleted (#8450)

* Added tests to lists shared by me after sharee is deleted

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

* Refactor tests

* Review address

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

* Review address

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

---------

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
Sagar Gurung
2024-02-16 15:16:29 +05:45
committed by GitHub
parent 21ea45cabf
commit c3d895445e
2 changed files with 100 additions and 9 deletions
@@ -2526,6 +2526,30 @@ class GraphContext implements Context {
);
}
/**
*
* @param string $user
* @param bool $waitForCacheExpiry
*
* @return void
*/
public function listSharesSharedByMe(string $user, bool $waitForCacheExpiry = false) {
$credentials = $this->getAdminOrUserCredentials($user);
if ($waitForCacheExpiry) {
// ENV (GRAPH_SPACES_GROUPS_CACHE_TTL | GRAPH_SPACES_USERS_CACHE_TTL) is set default to 60 sec
// which means 60 sec is required to clean up all the user|group cache once they are deleted
// for tests we have set the above ENV's to minimum which is 1 sec as we check the details for the deleted users
sleep(1);
}
$response = GraphHelper::getSharesSharedByMe(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$credentials['username'],
$credentials['password']
);
$this->featureContext->setResponse($response);
}
/**
* @When user :user lists the shares shared by him/her using the Graph API
*
@@ -2535,15 +2559,19 @@ class GraphContext implements Context {
* @throws GuzzleException
*/
public function userListsTheResourcesSharedByAUserUsingGraphApi(string $user): void {
$credentials = $this->getAdminOrUserCredentials($user);
$this->featureContext->setResponse(
GraphHelper::getSharesSharedByMe(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$credentials['username'],
$credentials['password']
)
);
$this->listSharesSharedByMe($user);
}
/**
* @When user :user lists the shares shared by him/her after clearing user/group cache using the Graph API
*
* @param string $user
*
* @return void
* @throws GuzzleException
*/
public function userListsTheResourcesSharedByAUserAfterClearingUserOrGroupSpaceUsingGraphApi(string $user): void {
$this->listSharesSharedByMe($user, true);
}
/**