Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions tests/acceptance/features/apiSharingNg/sharedByMe.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
SagarGi marked this conversation as resolved.
Show resolved Hide resolved
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
}
}
}
"""
43 changes: 34 additions & 9 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2526,6 +2526,27 @@ public function userListsTheResourcesSharedWithThemUsingGraphApi(string $user):
);
}

/**
*
* @param string $user
* @param bool $isCacheClear
SagarGi marked this conversation as resolved.
Show resolved Hide resolved
*
* @return void
*/
public function userListsResourcesSharedByHimOrHer(string $user, bool $isCacheClear = false) {
SagarGi marked this conversation as resolved.
Show resolved Hide resolved
$credentials = $this->getAdminOrUserCredentials($user);
if ($isCacheClear) {
sleep(1);
}
SagarGi marked this conversation as resolved.
Show resolved Hide resolved
$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
*
Expand All @@ -2535,15 +2556,19 @@ public function userListsTheResourcesSharedWithThemUsingGraphApi(string $user):
* @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->userListsResourcesSharedByHimOrHer($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->userListsResourcesSharedByHimOrHer($user, true);
}

/**
Expand Down