Added drive info check

This commit is contained in:
sagargurung1001@gmail.com
2022-11-30 16:50:58 +05:45
committed by Phil Davis
parent 6ff9d6196f
commit c80e773234
3 changed files with 38 additions and 16 deletions

View File

@@ -60,14 +60,10 @@ 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 drive information of user "Brian" should contain:
# | key | value |
# | driveType | personal |
# | driveAlias | personal/alice |
# | id | %space_id% |
# | name | Brian Murphy |
# | quota@@@state | normal |
# | root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
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
@@ -79,11 +75,7 @@ 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 drive information of user "Brian" should contain:
# | key | value |
# | driveType | personal |
# | driveAlias | personal/brian |
# | id | %space_id% |
# | name | Brian Murphy |
# | quota@@@state | normal |
# | root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
And the response should contain the following drive information:
| driveType | personal |
| driveAlias | personal/brian |
| name | Brian Murphy |

View File

@@ -28,6 +28,11 @@ class GraphContext implements Context {
*/
private FeatureContext $featureContext;
/**
* @var SpacesContext
*/
private SpacesContext $spacesContext;
/**
* This will run before EVERY scenario.
* It will set the properties for this object.
@@ -43,6 +48,7 @@ class GraphContext implements Context {
$environment = $scope->getEnvironment();
// Get all the contexts you need in this context from here
$this->featureContext = $environment->getContext('FeatureContext');
$this->spacesContext = $environment->getContext('SpacesContext');
}
/**
@@ -1357,4 +1363,25 @@ class GraphContext implements Context {
$response = $this->retrieveUserInformationAlongWithDriveUsingGraphApi($user);
$this->featureContext->setResponse($response);
}
/**
* @Then the response should contain the following drive information:
*/
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]
);
}
}
}

View File

@@ -913,6 +913,9 @@ class SpacesContext implements Context {
foreach ($table->getHash() as $row) {
// remember the original Space Array
$original = $spaceAsArray;
var_dump(
$original
);
$row['value'] = $this->featureContext->substituteInLineCodes(
$row['value'],
$this->featureContext->getCurrentUser(),