mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-18 15:13:32 -05:00
Drive infor assertion
This commit is contained in:
committed by
Phil Davis
parent
265db41819
commit
46575abe11
@@ -60,22 +60,28 @@ Feature: get users
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian |
|
||||
And the response should contain the following drive information:
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/brian |
|
||||
| name | Brian Murphy |
|
||||
And the user retrieve API response should contain the following drive information:
|
||||
# | driveType | personal |
|
||||
# | driveAlias | personal/brian |
|
||||
# | id | %space_id% |
|
||||
# | name | Brian Murphy |
|
||||
| owner@@@user@@@id | %user_id% |
|
||||
# | quota@@@state | normal |
|
||||
# | root@@@id | %space_id% |
|
||||
# | root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
# | webUrl | %base_url%/f/%space_id% |
|
||||
|
||||
|
||||
Scenario: normal user tries to get hid/her own drive information
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
When the user "Brian" tries to get his drive information using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian |
|
||||
And the response should contain the following drive information:
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/brian |
|
||||
| name | Brian Murphy |
|
||||
# Scenario: normal user tries to get hid/her own drive information
|
||||
# Given these users have been created with default attributes and without skeleton files:
|
||||
# | username |
|
||||
# | Brian |
|
||||
# When the user "Brian" tries to get his drive information using Graph API
|
||||
# Then the HTTP status code should be "200"
|
||||
# And the user retrieve API response should contain the following information:
|
||||
# | displayName | id | mail | onPremisesSamAccountName |
|
||||
# | Brian Murphy | %uuid_v4% | brian@example.org | Brian |
|
||||
# And the response should contain the following drive information:
|
||||
# | driveType | personal |
|
||||
# | driveAlias | personal/brian |
|
||||
# | name | Brian Murphy |
|
||||
|
||||
@@ -1364,23 +1364,43 @@ class GraphContext implements Context {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Then the response should contain the following drive information:
|
||||
* @param array $expectedDriveInformation
|
||||
* @param array $actualValueDriveInformation
|
||||
*
|
||||
* @throws GuzzleException
|
||||
* @return void
|
||||
*/
|
||||
public function theResponseShouldContainTheFollowingDriveInformation(TableNode $table)
|
||||
{
|
||||
$rows = $table->getRowsHash();
|
||||
$responseAPI = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['drive'];
|
||||
foreach (array_keys($rows) as $keyName) {
|
||||
Assert::assertEquals(
|
||||
$rows[$keyName],
|
||||
$responseAPI[$keyName],
|
||||
__METHOD__ .
|
||||
' Expected ' . $keyName . 'to have value' . $responseAPI[$keyName]
|
||||
. ' but got ' . $rows[$keyName]
|
||||
public function checkUserDriveInformation(array $expectedDriveInformation, array $actualValueDriveInformation):void {
|
||||
foreach (array_keys($expectedDriveInformation) as $keyName) {
|
||||
// break the segment with @@@ here
|
||||
$separatedKey = explode("@@@",$keyName);
|
||||
$actualKeyAvalue = null;
|
||||
$actualKeyAvalue = $actualValueDriveInformation['owner'];
|
||||
var_dump(
|
||||
$actualKeyAvalue
|
||||
);
|
||||
foreach ($separatedKey as $key) {
|
||||
// this loop sets and get the actual keyvalue from the actual API response
|
||||
$actualKeyAvalue = $actualValueDriveInformation[$key];
|
||||
}
|
||||
var_dump(
|
||||
$actualKeyAvalue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Then the user retrieve API response should contain the following drive information:
|
||||
*/
|
||||
public function theResponseShouldContainTheFollowingDriveInformation(TableNode $table)
|
||||
{
|
||||
$expectedDriveInformation = $table->getRowsHash();
|
||||
// array of user drive information (Personal Drive Information Only)
|
||||
$actualDriveInformation = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['drive'];
|
||||
$this->checkUserDriveInformation($expectedDriveInformation, $actualDriveInformation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user