checking users and groups

This commit is contained in:
Sergio Bertolin 2015-10-07 09:03:00 +00:00
parent bb9f568654
commit 1b0e128b44
2 changed files with 23 additions and 10 deletions

View file

@ -49,7 +49,6 @@ class FeatureContext extends BehatContext {
$this->sendingToWith($verb, $url, null);
}
/**
* Parses the xml answer to get ocs response which doesn't match with
* http one in v1 of the api.
@ -67,19 +66,14 @@ class FeatureContext extends BehatContext {
return $extractedElementsArray;
}
/**
* Parses the xml answer to get the array of groups returned.
*/
/*
public function getArrayOfGroupsResponded(){
$listCheckedElements = $this->$response->xml()->data[0]->groups[0]->element;
public function getArrayOfGroupsResponded($resp) {
$listCheckedElements = $resp->xml()->data[0]->groups[0]->element;
$extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1);
return $extractedElementsArray;
}
*/
/**
* @Then /^users returned are$/
@ -93,8 +87,20 @@ class FeatureContext extends BehatContext {
}
}
/**
* @Then /^groups returned are$/
* @param \Behat\Gherkin\Node\TableNode|null $formData
*/
public function theGroupsShouldBe($groupsList) {
if ($groupsList instanceof \Behat\Gherkin\Node\TableNode) {
$groups = $groupsList->getRows()[0];
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
PHPUnit_Framework_Assert::assertEquals($groups, $respondedArray);
}
}
/**
* @Then /^the OCS status code should be "([^"]*)"$/
*/

View file

@ -44,7 +44,7 @@ Feature: provisioning
Given As an "admin"
When sending "GET" to "/cloud/users"
And users returned are
| brand-new-user | ser507 |
| brand-new-user | admin |
Scenario: Edit a user
@ -81,6 +81,13 @@ Feature: provisioning
And group "new-group" exists
Scenario: Getting all users
Given As an "admin"
When sending "GET" to "/cloud/groups"
And groups returned are
| admin | new-group |
Scenario: Delete a group
Given As an "admin"
And group "new-group" exists