mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-28 14:59:49 -05:00
[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:
@@ -1451,3 +1451,66 @@ Feature: resources shared by user
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@env-config
|
||||
Scenario: user lists shared resources for deleted sharee
|
||||
Given the config "GRAPH_SPACES_USERS_CACHE_TTL" has been set to "1"
|
||||
And the administrator has assigned the role "Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has uploaded file with content "hello world" to "textfile.txt"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | textfile.txt |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
And the administrator has deleted user "Brian" using the provisioning API
|
||||
When user "Alice" lists the shares shared by her after clearing user cache using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"minItems":0,
|
||||
"maxItems":0
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@env-config
|
||||
Scenario: user lists shared resources for deleted group
|
||||
Given the config "GRAPH_SPACES_GROUPS_CACHE_TTL" has been set to "1"
|
||||
And group "grp1" has been created
|
||||
And the administrator has assigned the role "Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has uploaded file with content "hello world" to "textfile.txt"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | textfile.txt |
|
||||
| space | Personal |
|
||||
| sharee | grp1 |
|
||||
| shareType | group |
|
||||
| permissionsRole | Viewer |
|
||||
And group "grp1" has been deleted
|
||||
When user "Alice" lists the shares shared by her after clearing group cache using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"value"
|
||||
],
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "array",
|
||||
"minItems":0,
|
||||
"maxItems":0
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user