diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-08 16:17:30 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-08 16:17:30 +0200 |
commit | adeab41e2ab86e149912e37cdc7ee8bb5a0625c7 (patch) | |
tree | c7f47fccd10d286290a47c47226f32b974f8f6f4 /build | |
parent | 12277869303d3c0183acc9868ca4d6bd591800fd (diff) | |
parent | 8f91426e0af32aa4007d9f3b4749a78261a44279 (diff) | |
download | nextcloud-server-adeab41e2ab86e149912e37cdc7ee8bb5a0625c7.tar.gz nextcloud-server-adeab41e2ab86e149912e37cdc7ee8bb5a0625c7.zip |
Merge pull request #19616 from owncloud/ocs_provisioning_api_checking_lists
Ocs provisioning api checking lists
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/FeatureContext.php | 45 | ||||
-rw-r--r-- | build/integration/features/provisioning-v1.feature | 20 |
2 files changed, 64 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 9676fc8ca40..f440aece603 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. @@ -59,6 +58,50 @@ class FeatureContext extends BehatContext { } /** + * Parses the xml answer to get the array of users returned. + */ + public function getArrayOfUsersResponded($resp) { + $listCheckedElements = $resp->xml()->data[0]->users[0]->element; + $extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1); + return $extractedElementsArray; + } + + /** + * Parses the xml answer to get the array of groups returned. + */ + 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$/ + * @param \Behat\Gherkin\Node\TableNode|null $formData + */ + public function theUsersShouldBe($usersList) { + if ($usersList instanceof \Behat\Gherkin\Node\TableNode) { + $users = $usersList->getRows()[0]; + $respondedArray = $this->getArrayOfUsersResponded($this->response); + PHPUnit_Framework_Assert::assertEquals(asort($users), asort($respondedArray)); + } + + } + + /** + * @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(asort($groups), asort($respondedArray)); + } + + } + + /** * @Then /^the OCS status code should be "([^"]*)"$/ */ public function theOCSStatusCodeShouldBe($statusCode) { diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index 823fd823c5e..d865ee687ed 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -40,6 +40,16 @@ Feature: provisioning And the HTTP status code should be "200" + Scenario: Getting all users + Given As an "admin" + And user "brand-new-user" exists + And user "admin" exists + When sending "GET" to "/cloud/users" + And users returned are + | brand-new-user | + | admin | + + Scenario: Edit a user Given As an "admin" And user "brand-new-user" exists @@ -74,6 +84,16 @@ Feature: provisioning And group "new-group" exists + Scenario: Getting all groups + Given As an "admin" + And group "new-group" exists + And group "admin" exists + 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 |