From 1b0e128b4407fefe9ff7be7366bacbac94d101c9 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 7 Oct 2015 09:03:00 +0000 Subject: [PATCH] checking users and groups --- .../features/bootstrap/FeatureContext.php | 24 ++++++++++++------- .../features/provisioning-v1.feature | 9 ++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 99d030fa6f..a09e74de57 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -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 "([^"]*)"$/ */ diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index 448c06b8b5..ad6841142a 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -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