[tests-only][full-ci]adding tests for enable disable sync when sharer is deleted (#9130)

* adding tests for enable disable sync when sharer is deleted

* addhressing reviews
This commit is contained in:
Sabin Panta
2024-05-15 12:58:22 +05:45
committed by GitHub
parent b09f3d48f8
commit 95c93f63b7
3 changed files with 235 additions and 1 deletions

View File

@@ -413,3 +413,232 @@ Feature: enable or disable sync of incoming shares
}
}
"""
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
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"
}
}
}
}
}
"""

View File

@@ -1881,6 +1881,7 @@ trait Provisioning {
$response = $this->graphContext->deleteGroupWithName($group);
$this->theHTTPStatusCodeShouldBe(204, "", $response);
}
$this->rememberThatGroupIsNotExpectedToExist($group);
Assert::assertFalse(
$this->groupExists($group),
"Group '$group' should not exist but does exist"
@@ -1937,7 +1938,7 @@ trait Provisioning {
$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(

View File

@@ -1001,6 +1001,7 @@ class SharingNgContext implements Context {
/**
* @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
*
@@ -1080,7 +1081,10 @@ class SharingNgContext implements Context {
}
/**
* 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