From c42e5ae6baf9bc909680fadcd036343f3853173a Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi <41103328+SwikritiT@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:04:07 +0545 Subject: [PATCH] [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 --- .../features/apiSpaces/listSpaces.feature | 83 ++++++++++++++++++- .../features/bootstrap/SpacesContext.php | 24 ++++++ 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiSpaces/listSpaces.feature b/tests/acceptance/features/apiSpaces/listSpaces.feature index 2cd8951ba2..fb6584b363 100644 --- a/tests/acceptance/features/apiSpaces/listSpaces.feature +++ b/tests/acceptance/features/apiSpaces/listSpaces.feature @@ -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 "" 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 | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index af52809c89..232578d8c4 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -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,