diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-07 12:48:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 12:48:44 -0500 |
commit | 4c60360bf733fab8882939f2cd9dca57b6fe405e (patch) | |
tree | 02a94b0868fb5609eee3a22ccfc5fb85c39863d8 /build/integration | |
parent | 325f925e147ff711d12f1b433c6aa6c55d79fb40 (diff) | |
parent | 3d628783d93edc7e067dcaaa3f1883dd84108a85 (diff) | |
download | nextcloud-server-4c60360bf733fab8882939f2cd9dca57b6fe405e.tar.gz nextcloud-server-4c60360bf733fab8882939f2cd9dca57b6fe405e.zip |
Merge pull request #4221 from nextcloud/provisioning-api-for-account-info
Allow to change account info via provisioning api
Diffstat (limited to 'build/integration')
-rw-r--r-- | build/integration/features/bootstrap/Provisioning.php | 26 | ||||
-rw-r--r-- | build/integration/features/provisioning-v1.feature | 47 |
2 files changed, 71 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 2e17508120c..94da63a653f 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -121,6 +121,32 @@ trait Provisioning { $client->send($client->createRequest('GET', $url, $options2)); } + /** + * @Then /^user "([^"]*)" has$/ + * + * @param string $user + * @param \Behat\Gherkin\Node\TableNode|null $settings + */ + public function userHasSetting($user, $settings) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; + $client = new Client(); + $options = []; + $options['auth'] = $this->adminUser; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; + + $response = $client->send($client->createRequest("GET", $fullUrl, $options)); + foreach ($settings->getRows() as $setting) { + $value = json_decode(json_encode($response->xml()->data->{$setting[0]}), 1); + if (isset($value[0])) { + PHPUnit_Framework_Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true); + } else { + PHPUnit_Framework_Assert::assertEquals('', $setting[1]); + } + } + } + public function createUser($user) { $previous_user = $this->currentUser; $this->currentUser = "admin"; diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index ad9d901d051..555960b8a55 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -32,6 +32,14 @@ Feature: provisioning | password | 123456 | Then the OCS status code should be "102" And the HTTP status code should be "200" + And user "brand-new-user" has + | id | brand-new-user | + | displayname | brand-new-user | + | email | | + | phone | | + | address | | + | website | | + | twitter | | Scenario: Get an existing user Given As an "admin" @@ -52,13 +60,48 @@ Feature: provisioning Given As an "admin" And user "brand-new-user" exists When sending "PUT" to "/cloud/users/brand-new-user" with + | key | displayname | + | value | Brand New User | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And sending "PUT" to "/cloud/users/brand-new-user" with | key | quota | | value | 12MB | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And sending "PUT" to "/cloud/users/brand-new-user" with | key | email | | value | brand-new-user@gmail.com | - Then the OCS status code should be "100" + And the OCS status code should be "100" And the HTTP status code should be "200" - And user "brand-new-user" exists + And sending "PUT" to "/cloud/users/brand-new-user" with + | key | phone | + | value | 0123 456 789 | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And sending "PUT" to "/cloud/users/brand-new-user" with + | key | address | + | value | Foo Bar Town | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And sending "PUT" to "/cloud/users/brand-new-user" with + | key | website | + | value | https://nextcloud.com | + And the OCS status code should be "100" + And the HTTP status code should be "200" + And sending "PUT" to "/cloud/users/brand-new-user" with + | key | twitter | + | value | Nextcloud | + And the OCS status code should be "100" + And the HTTP status code should be "200" + Then user "brand-new-user" has + | id | brand-new-user | + | displayname | Brand New User | + | email | brand-new-user@gmail.com | + | phone | 0123 456 789 | + | address | Foo Bar Town | + | website | https://nextcloud.com | + | twitter | Nextcloud | Scenario: Create a group Given As an "admin" |