adding test for listing drive items with new props in personal space

This commit is contained in:
Niraj Acharya
2024-07-16 12:51:47 +05:45
parent 38bc0a50b5
commit 740793ec18
2 changed files with 156 additions and 0 deletions
@@ -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"
}
}
}
}
}
"""
@@ -4094,4 +4094,30 @@ class SpacesContext implements Context {
"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),
)
);
}
}