aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-05-27 14:56:22 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-05-27 23:02:44 +0000
commit533eb89b546dc1bae5138b55ef0011406f841e67 (patch)
tree8cf43ad3681ca8b9ed514543dc6fdbd43cab251c /build
parent0d9c60613ed146a136a704e6b172a4eb2d3006f1 (diff)
downloadnextcloud-server-533eb89b546dc1bae5138b55ef0011406f841e67.tar.gz
nextcloud-server-533eb89b546dc1bae5138b55ef0011406f841e67.zip
Add integration tests for the editable fields
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/Provisioning.php30
-rw-r--r--build/integration/features/provisioning-v1.feature26
2 files changed, 56 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index cbe11403ba8..d613986df60 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -178,6 +178,36 @@ trait Provisioning {
}
/**
+ * @Then /^user "([^"]*)" has editable fields$/
+ *
+ * @param string $user
+ * @param \Behat\Gherkin\Node\TableNode|null $fields
+ */
+ public function userHasEditableFields($user, $fields) {
+ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/user/fields";
+ if ($user !== 'self') {
+ $fullUrl .= '/' . $user;
+ }
+ $client = new Client();
+ $options = [];
+ if ($this->currentUser === 'admin') {
+ $options['auth'] = $this->adminUser;
+ } else {
+ $options['auth'] = [$this->currentUser, $this->regularUser];
+ }
+ $options['headers'] = [
+ 'OCS-APIREQUEST' => 'true',
+ ];
+
+ $response = $client->get($fullUrl, $options);
+ $fieldsArray = json_decode(json_encode(simplexml_load_string($response->getBody())->data->element), 1);
+
+ $expectedFields = $fields->getRows();
+ $expectedFields = $this->simplifyArray($expectedFields);
+ Assert::assertEquals($expectedFields, $fieldsArray);
+ }
+
+ /**
* @Then /^search users by phone for region "([^"]*)" with$/
*
* @param string $user
diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature
index 03aaad4b857..9a7db6f4af2 100644
--- a/build/integration/features/provisioning-v1.feature
+++ b/build/integration/features/provisioning-v1.feature
@@ -56,6 +56,32 @@ Feature: provisioning
| brand-new-user |
| admin |
+ Scenario: Get editable fields
+ Given As an "admin"
+ And user "brand-new-user" exists
+ Then user "brand-new-user" has editable fields
+ | displayname |
+ | email |
+ | phone |
+ | address |
+ | website |
+ | twitter |
+ Given As an "brand-new-user"
+ Then user "brand-new-user" has editable fields
+ | displayname |
+ | email |
+ | phone |
+ | address |
+ | website |
+ | twitter |
+ Then user "self" has editable fields
+ | displayname |
+ | email |
+ | phone |
+ | address |
+ | website |
+ | twitter |
+
Scenario: Edit a user
Given As an "admin"
And user "brand-new-user" exists