[tests-only][full-ci]Adds test for getting share jail space information of the user when user has pending share (#7530)

* Adds test for getting share jail space information of the user when user has a pending share

* fix style and add issue tag

* address reviews
This commit is contained in:
Swikriti Tripathi
2023-10-20 15:04:07 +05:45
committed by GitHub
parent 4918a8a92b
commit c42e5ae6ba
2 changed files with 106 additions and 1 deletions
@@ -423,6 +423,87 @@ Feature: List and create spaces
Then the HTTP status code should be "404"
And the json responded should not contain a space with name "Project Venus"
Examples:
| role |
| role |
| User |
| User Light |
@issue-7160
Scenario Outline: get share jail space information of the user when user has a pending share
Given user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has disabled auto-accepting
And user "Brian" has uploaded file with content "this is a test file." to "test.txt"
And the administrator has assigned the role "<userRole>" to user "Alice" using the Graph API
And user "Brian" has shared file "/test.txt" with user "Alice"
When user "Alice" lists all available spaces via the GraphApi
Then the HTTP status code should be "200"
And the JSON response should contain space called "Shares" owned by "Alice" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Shares"]
},
"driveType": {
"type": "string",
"enum": ["virtual"]
},
"driveAlias": {
"type": "string",
"enum": ["virtual/shares"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["normal"]
}
}
},
"root": {
"type": "object",
"required": [
"eTag",
"webDavUrl"
],
"properties": {
"eTag": {
"type": "string",
"enum": ["%space_etag%"]
},
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Examples:
| userRole |
| Admin |
| Space Admin |
| User |
| User Light |
@@ -388,6 +388,24 @@ class SpacesContext implements Context {
return \str_replace('"', '\"', $fileData["Etag"][0]);
}
/**
* @param string $user
* @param string $spaceName
*
* @return string
*
* @throws GuzzleException
*/
public function getEtagOfASpace(string $user, string $spaceName): string {
$this->theUserLooksUpTheSingleSpaceUsingTheGraphApiByUsingItsId($user, $spaceName);
$this->featureContext->theHTTPStatusCodeShouldBe(
200,
"Expected response status code should be 200"
);
$decodedResponse = $this->featureContext->getJsonDecodedResponse();
return $decodedResponse["root"]["eTag"];
}
/**
* @BeforeScenario
*
@@ -916,6 +934,12 @@ class SpacesContext implements Context {
[$this, "getETag"],
"parameter" => [$userName, $spaceName, $fileName]
],
[
"code" => "%space_etag%",
"function" =>
[$this, "getEtagOfASpace"],
"parameter" => [$userName, $spaceName]
]
],
null,
$userName,