Skip to content

Commit

Permalink
adding test for listing drive items with new props in personal space
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajacharya2 committed Jul 17, 2024
1 parent 38bc0a5 commit 740793e
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,133 @@ Feature: propfind extracted props
| oc:photo/oc:camera-model | COOLPIX P6000 |
| oc:photo/oc:f-number | 4.5 |
| oc:photo/oc:focal-length | 6 |


Scenario: GET extracted properties of an audio file (Personal space)
Given user "Alice" has uploaded a file "filesForUpload/testaudio.mp3" to "testaudio.mp3" in space "Personal"
When user "Alice" gets the file "testaudio.mp3" from space "Personal" 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 (Personal space)
Given user "Alice" has uploaded a file "filesForUpload/testavatar.jpg" to "testavatar.jpg" in space "Personal"
When user "Alice" gets the file "testavatar.jpg" from space "Personal" 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"
}
}
}
}
}
"""
26 changes: 26 additions & 0 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -4094,4 +4094,30 @@ public function userHasSharedResourceInsideSpaceWithUser(string $sharer, string
"OCS status code is not any of the expected values " . \implode(",", $statusCodes) . " got " . $responseStatusCode
);
}

/**
* @When user :user gets the file :file from space :space using the Graph API
*
* @param string $user
* @param string $file
* @param string $space
*
* @return void
*/
public function userGetsTheDriveItemInSpace(string $user, string $file, string $space):void {
$spaceId = ($this->getSpaceByName($user, $space))["id"];
$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
sleep(2);
$this->featureContext->setResponse(
HttpRequestHelper::get(
$url,
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
)
);
}
}

0 comments on commit 740793e

Please sign in to comment.