From fcb33ed3ddf59bdce009a52555d04c8615466bfc Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Tue, 16 Jul 2024 12:51:47 +0545 Subject: [PATCH] adding test for listing drive items with new props in personal space --- .../apiSearchContent/extractedProps.feature | 144 ++++++++++++++++++ .../features/bootstrap/SpacesContext.php | 13 +- 2 files changed, 156 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiSearchContent/extractedProps.feature b/tests/acceptance/features/apiSearchContent/extractedProps.feature index c526925e4..e90ffbec2 100644 --- a/tests/acceptance/features/apiSearchContent/extractedProps.feature +++ b/tests/acceptance/features/apiSearchContent/extractedProps.feature @@ -313,6 +313,150 @@ Feature: propfind extracted props And user "Alice" has uploaded a file "filesForUpload/testavatar.jpg" to "testavatar.jpg" in space "new-space" When user "Alice" gets the file "testavatar.jpg" from space "new-space" using the Graph API Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "image", + "location", + "photo" + ], + "properties": { + "image": { + "type": "object", + "required": [ "height", "width" ], + "properties": { + "height": { + "const": 480 + }, + "width": { + "const": 640 + } + } + }, + "location": { + "type": "object", + "required": [ "latitude", "longitude" ], + "properties": { + "latitude": { + "const": 43.467157 + }, + "longitude": { + "const": 11.885395 + } + } + }, + "photo": { + "type": "object", + "required": [ + "cameraMake", + "cameraModel", + "exposureDenominator", + "exposureNumerator", + "fNumber", + "focalLength", + "orientation", + "takenDateTime" + ], + "properties": { + "cameraMake": { + "const": "NIKON" + }, + "cameraModel": { + "const": "COOLPIX P6000" + }, + "exposureDenominator": { + "const": 178 + }, + "exposureNumerator": { + "const": 1 + }, + "fNumber": { + "const": 4.5 + }, + "focalLength": { + "const": 6 + }, + "orientation": { + "const": 1 + }, + "takenDateTime": { + "const": "2008-10-22T16:29:49Z" + } + } + } + } + } + """ + + + Scenario: GET extracted properties of an audio file (Shares space) + Given user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has uploaded a file "filesForUpload/testaudio.mp3" to "testaudio.mp3" in space "Personal" + And user "Alice" has sent the following resource share invitation: + | resource | testaudio.mp3 | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" gets the file "testaudio.mp3" from space "Shares" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "object", + "required": [ + "album", + "artist", + "genre", + "title", + "track", + "year" + ], + "properties": { + "album": { + "const": "ALBUM1234567890123456789012345" + }, + "artist": { + "const": "ARTIST123456789012345678901234" + }, + "genre": { + "const": "Pop" + }, + "title": { + "const": "TITLE1234567890123456789012345" + }, + "track": { + "const": 1 + }, + "year": { + "const": 2001 + } + } + } + } + } + """ + + + Scenario: GET extracted properties of an image file (Shares space) + Given user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has uploaded a file "filesForUpload/testavatar.jpg" to "testavatar.jpg" in space "Personal" + And user "Alice" has sent the following resource share invitation: + | resource | testavatar.jpg | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" gets the file "testavatar.jpg" from space "Shares" using the Graph API + Then the HTTP status code should be "200" And the JSON data of the response should match """ { diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index a84ff08a8..9cf94d860 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -4106,7 +4106,18 @@ class SpacesContext implements Context { */ public function userGetsTheDriveItemInSpace(string $user, string $file, string $space):void { $spaceId = ($this->getSpaceByName($user, $space))["id"]; - $itemId = $this->getFileId($user, $space, $file); + $itemId = ''; + if ($space === "Shares") { + $itemId = GraphHelper::getShareMountId( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $file + ); + } else { + $itemId = $this->getFileId($user, $space, $file); + } $url = $this->featureContext->getBaseUrl() . "/graph/v1.0/drives/$spaceId/items/$itemId"; // NOTE: extracting properties occurs asynchronously // short wait is necessary before getting those properties