[full-ci] [tests-only] Backport of pr 8179, 8166 (#8110)

* added test to send share invitation to a deleted group

* Added test for sending share invitation to deleted user

* Added to expected failure

---------

Co-authored-by: prajwol <prajwolamatya11@gmail.com>
This commit is contained in:
Prarup Gurung
2024-01-12 12:50:05 +05:45
committed by GitHub
parent 9ac7d0cd24
commit e0d3add500
5 changed files with 155 additions and 4 deletions

View File

@@ -265,5 +265,25 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiSharingNg/linkShare.feature:447](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L447)
- [apiSharingNg/linkShare.feature:448](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L448)
- [apiSharingNg/linkShare.feature:449](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L449)
### [Share invitation to deleted user or group gives 500 (Fixed on master)](https://github.com/owncloud/ocis/issues/7962)
- [apiSharingNg/shareInvitations.feature:918](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L918)
- [apiSharingNg/shareInvitations.feature:919](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L919)
- [apiSharingNg/shareInvitations.feature:920](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L920)
- [apiSharingNg/shareInvitations.feature:921](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L921)
- [apiSharingNg/shareInvitations.feature:922](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L922)
- [apiSharingNg/shareInvitations.feature:923](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L923)
- [apiSharingNg/shareInvitations.feature:924](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L924)
- [apiSharingNg/shareInvitations.feature:925](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L925)
- [apiSharingNg/shareInvitations.feature:926](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L926)
- [apiSharingNg/shareInvitations.feature:973](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L973)
- [apiSharingNg/shareInvitations.feature:974](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L974)
- [apiSharingNg/shareInvitations.feature:975](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L975)
- [apiSharingNg/shareInvitations.feature:976](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L976)
- [apiSharingNg/shareInvitations.feature:977](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L977)
- [apiSharingNg/shareInvitations.feature:978](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L978)
- [apiSharingNg/shareInvitations.feature:979](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L979)
- [apiSharingNg/shareInvitations.feature:980](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L980)
- [apiSharingNg/shareInvitations.feature:981](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/shareInvitations.feature#L981)
- Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.

View File

@@ -81,7 +81,7 @@ Feature: create user
Scenario: user can be created with the name of the deleted user
Given user "Brian" has been created with default attributes and without skeleton files
And the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And the user "Alice" has deleted a user "Brian" using the Graph API
And the user "Alice" has deleted a user "Brian"
When the user "Alice" creates a new user with the following attributes using the Graph API:
| userName | Brian |
| displayName | This is another Brian |

View File

@@ -102,7 +102,7 @@ Feature: edit user
| displayName | sam |
| email | sam@example.com |
| password | 1234 |
And the user "Alice" has deleted a user "sam" using the Graph API
And the user "Alice" has deleted a user "sam"
When the user "Alice" changes the user name of user "Brian" to "sam" using the Graph API
Then the HTTP status code should be "200"
And the user information of "sam" should match this JSON schema

View File

@@ -861,3 +861,121 @@ Feature: Send a sharing invitations
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
Scenario Outline: send sharing invitation to a deleted group with different roles
Given user "Carol" has been created with default attributes and without skeleton files
And group "grp1" has been created
And the following users have been added to the following groups
| username | groupname |
| Brian | grp1 |
| Carol | grp1 |
And user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
And user "Alice" has created folder "FolderToShare"
And the administrator has deleted group "grp1"
When user "Alice" sends the following share invitation using the Graph API:
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"enum": [
"generalException"
]
},
"message": {
"type": "string",
"enum": [
"itemNotFound: not found"
]
}
}
}
}
}
"""
Examples:
| permissions-role | resource-type | path |
| Viewer | file | /textfile1.txt |
| File Editor | file | /textfile1.txt |
| Co Owner | file | /textfile1.txt |
| Manager | file | /textfile1.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |
Scenario Outline: send share invitation to deleted user
Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
And user "Alice" has created folder "FolderToShare"
And the user "Admin" has deleted a user "Brian"
When user "Alice" sends the following share invitation using the Graph API:
| resourceType | <resource-type> |
| resource | <path> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"pattern": "generalException"
},
"message": {
"type": "string",
"enum": [
"itemNotFound: not found"
]
}
}
}
}
}
"""
Examples:
| permissions-role | resource-type | path |
| Viewer | file | /textfile1.txt |
| File Editor | file | /textfile1.txt |
| Co Owner | file | /textfile1.txt |
| Manager | file | /textfile1.txt |
| Viewer | folder | FolderToShare |
| Editor | folder | FolderToShare |
| Co Owner | folder | FolderToShare |
| Uploader | folder | FolderToShare |
| Manager | folder | FolderToShare |

View File

@@ -431,7 +431,7 @@ class GraphContext implements Context {
}
/**
* @Given /^the user "([^"]*)" has deleted a user "([^"]*)" using the Graph API$/
* @Given /^the user "([^"]*)" has deleted a user "([^"]*)"$/
*
* @param string $byUser
* @param string $user
@@ -440,7 +440,7 @@ class GraphContext implements Context {
* @throws Exception
* @throws GuzzleException
*/
public function theUserHasDeletesAUserUsingTheGraphAPI(string $byUser, string $user): void {
public function theUserHasDeletedAUser(string $byUser, string $user): void {
$response = $this->adminDeletesUserUsingTheGraphApi($user, $byUser);
$this->featureContext->theHttpStatusCodeShouldBe(204, "", $response);
}
@@ -1079,6 +1079,19 @@ class GraphContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @Given the administrator has deleted group :group
*
* @param string $group
*
* @return void
*/
public function theAdministratorHasDeletedGroup(string $group): void {
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
$response = $this->userDeletesGroupWithGroupId($groupId);
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
}
/**
* @Then the following users should be listed in the following groups
*