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]adding tests for enable disable sync when sharer is deleted #9130

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
229 changes: 229 additions & 0 deletions tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,232 @@ Feature: enable or disable sync of incoming shares
}
}
"""

S-Panta marked this conversation as resolved.
Show resolved Hide resolved

Scenario: try to enable sync of shared resource from Personal Space when sharer is deleted
Given user "Brian" has disabled the auto-sync share
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And the user "Admin" has deleted a user "Alice"
When user "Brian" tries to enable share sync of a resource "<<FILEID>>" using the Graph API
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",
"innererror",
"message"
],
"properties": {
"code" : {
"const": "invalidRequest"
},
"innererror" : {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message" : {
"const": "converting to drive items failed"
}
}
}
}
}
"""


Scenario: try to disable sync of shared resource from Personal Space when sharer is deleted
Given user "Brian" has disabled the auto-sync share
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And the user "Admin" has deleted a user "Alice"
When user "Brian" tries to disable sync of share "textfile0.txt" using the Graph API
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",
"innererror",
"message"
],
"properties": {
"code" : {
"const": "invalidRequest"
},
"innererror" : {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message" : {
"const": "unmounting share failed"
}
}
}
}
}
"""


Scenario: enable sync of shared resource from Project Space when sharer is deleted
Given user "Brian" has disabled the auto-sync share
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And the user "Admin" has deleted a user "Alice"
When user "Brian" enables share sync of a resource "<<FILEID>>" using the Graph API
S-Panta marked this conversation as resolved.
Show resolved Hide resolved
Then the HTTP status code should be "201"
And user "Brian" should have sync enabled for share "textfile0.txt"


Scenario: disable sync of shared resource from Project Space when sharer is deleted
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And the user "Admin" has deleted a user "Alice"
When user "Brian" disables sync of share "textfile0.txt" using the Graph API
Then the HTTP status code should be "204"
And user "Brian" should have sync disabled for share "textfile0.txt"


Scenario: try to enable sync of group shared resource when sharer is deleted
Given user "Brian" has disabled the auto-sync share
And group "grp1" has been created
And user "Alice" has been added to group "grp1"
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
And group "grp1" has been deleted
When user "Brian" tries to enable share sync of a resource "<<FILEID>>" using the Graph API
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",
"innererror",
"message"
],
"properties": {
"code" : {
"const": "invalidRequest"
},
"innererror" : {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message" : {
"const": "mounting share failed"
}
}
}
}
}
"""


Scenario: try to disable sync of group shared resource when sharer is deleted
Given user "Brian" has disabled the auto-sync share
And group "grp1" has been created
And user "Alice" has been added to group "grp1"
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And we save it into "FILEID"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
And group "grp1" has been deleted
When user "Brian" tries to disable sync of share "textfile0.txt" using the Graph API
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",
"innererror",
"message"
],
"properties": {
"code" : {
"const": "invalidRequest"
},
"innererror" : {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message" : {
"const": "unmounting share failed"
}
}
}
}
}
"""
3 changes: 2 additions & 1 deletion tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,7 @@ public function groupHasBeenDeleted(string $group):void {
$response = $this->graphContext->deleteGroupWithName($group);
$this->theHTTPStatusCodeShouldBe(204, "", $response);
}
$this->rememberThatGroupIsNotExpectedToExist($group);
S-Panta marked this conversation as resolved.
Show resolved Hide resolved
Assert::assertFalse(
$this->groupExists($group),
"Group '$group' should not exist but does exist"
Expand Down Expand Up @@ -1937,7 +1938,7 @@ public function adminHasRemovedUserFromGroup(string $user, string $group):void {
$response = $this->graphContext->removeUserFromGroup($group, $user);
$this->TheHTTPStatusCodeShouldBe(204, '', $response);
}

if (OcisHelper::isTestingOnReva()) {
$fullUrl = $this->getBaseUrl() . "/ocs/v2.php/cloud/users/$user/groups";
$response = HttpRequestHelper::get(
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ public function userHasDisabledSyncOfLastSharedResource(string $user):void {

/**
* @When user :user disables sync of share :share using the Graph API
* @When user :user tries to disable sync of share :share using the Graph API
*
* @param string $user
*
Expand Down Expand Up @@ -1080,7 +1081,10 @@ public function userEnablesSyncOfShareUsingTheGraphApi(string $user, string $sha
}

/**
* step definition for enabling sync for items for non-existing group|user|space sharer
*
* @When user :user tries to enable share sync of a resource :resource using the Graph API
* @When user :user enables share sync of a resource :resource using the Graph API
*
* @param string $user
* @param string $resource
Expand Down