diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/Provisioning.php | 47 | ||||
-rw-r--r-- | build/integration/features/provisioning-v1.feature | 80 | ||||
-rwxr-xr-x | build/update-apps.sh | 8 | ||||
-rwxr-xr-x | build/update.sh | 6 |
4 files changed, 129 insertions, 12 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 8eab793d66b..e51339c081e 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -168,14 +168,19 @@ trait Provisioning { $response = $client->get($fullUrl, $options); foreach ($settings->getRows() as $setting) { $value = json_decode(json_encode(simplexml_load_string($response->getBody())->data->{$setting[0]}), 1); - if (isset($value[0])) { + if (isset($value['element']) && in_array($setting[0], ['additional_mail', 'additional_mailScope'], true)) { + $expectedValues = explode(';', $setting[1]); + foreach ($expectedValues as $expected) { + Assert::assertTrue(in_array($expected, $value['element'], true)); + } + } elseif (isset($value[0])) { Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true); } else { Assert::assertEquals('', $setting[1]); } } } - + /** * @Then /^group "([^"]*)" has$/ * @@ -194,7 +199,7 @@ trait Provisioning { $options['headers'] = [ 'OCS-APIREQUEST' => 'true', ]; - + $response = $client->get($fullUrl, $options); $groupDetails = simplexml_load_string($response->getBody())->data[0]->groups[0]->element; foreach ($settings->getRows() as $setting) { @@ -206,7 +211,7 @@ trait Provisioning { } } } - + /** * @Then /^user "([^"]*)" has editable fields$/ @@ -967,4 +972,38 @@ trait Provisioning { } $this->usingServer($previousServer); } + + /** + * @Then /^user "([^"]*)" has not$/ + */ + public function userHasNotSetting($user, \Behat\Gherkin\Node\TableNode $settings) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$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); + foreach ($settings->getRows() as $setting) { + $value = json_decode(json_encode(simplexml_load_string($response->getBody())->data->{$setting[0]}), 1); + if (isset($value[0])) { + if (in_array($setting[0], ['additional_mail', 'additional_mailScope'], true)) { + $expectedValues = explode(';', $setting[1]); + foreach ($expectedValues as $expected) { + Assert::assertFalse(in_array($expected, $value, true)); + } + } else { + Assert::assertNotEquals($setting[1], $value[0], "", 0.0, 10, true); + } + } else { + Assert::assertNotEquals('', $setting[1]); + } + } + } } diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index dec6d2213e3..41041dc91da 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -62,6 +62,7 @@ Feature: provisioning Then user "brand-new-user" has editable fields | displayname | | email | + | additional_mail | | phone | | address | | website | @@ -70,6 +71,7 @@ Feature: provisioning Then user "brand-new-user" has editable fields | displayname | | email | + | additional_mail | | phone | | address | | website | @@ -77,6 +79,7 @@ Feature: provisioning Then user "self" has editable fields | displayname | | email | + | additional_mail | | phone | | address | | website | @@ -100,6 +103,16 @@ Feature: provisioning | value | no-reply@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 | additional_mail | + | value | no.reply@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 | additional_mail | + | value | noreply@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 | phone | | value | +49 711 / 25 24 28-90 | @@ -124,6 +137,7 @@ Feature: provisioning | id | brand-new-user | | displayname | Brand New User | | email | no-reply@nextcloud.com | + | additional_mail | no.reply@nextcloud.com;noreply@nextcloud.com | | phone | +4971125242890 | | address | Foo Bar Town | | website | https://nextcloud.com | @@ -177,6 +191,33 @@ Feature: provisioning | displaynameScope | v2-federated | | avatarScope | v2-local | + Scenario: Edit a user account multivalue property scopes + Given user "brand-new-user" exists + And As an "brand-new-user" + When sending "PUT" to "/cloud/users/brand-new-user" with + | key | additional_mail | + | value | no.reply@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 | additional_mail | + | value | noreply@nextcloud.com | + And the OCS status code should be "100" + And the HTTP status code should be "200" + When sending "PUT" to "/cloud/users/brand-new-user/additional_mailScope" with + | key | no.reply@nextcloud.com | + | value | v2-federated | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + When sending "PUT" to "/cloud/users/brand-new-user/additional_mailScope" with + | key | noreply@nextcloud.com | + | value | v2-published | + Then 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 | + | additional_mailScope | v2-federated;v2-published | + Scenario: Edit a user account properties scopes with invalid or unsupported value Given user "brand-new-user" exists And As an "brand-new-user" @@ -196,6 +237,43 @@ Feature: provisioning Then the OCS status code should be "102" And the HTTP status code should be "200" + Scenario: Edit a user account multi-value property scopes with invalid or unsupported value + Given user "brand-new-user" exists + And As an "brand-new-user" + When sending "PUT" to "/cloud/users/brand-new-user" with + | key | additional_mail | + | value | no.reply@nextcloud.com | + And the OCS status code should be "100" + And the HTTP status code should be "200" + When sending "PUT" to "/cloud/users/brand-new-user/additional_mailScope" with + | key | no.reply@nextcloud.com | + | value | invalid | + Then the OCS status code should be "102" + And the HTTP status code should be "200" + + Scenario: Delete a user account multi-value property value + Given user "brand-new-user" exists + And As an "brand-new-user" + When sending "PUT" to "/cloud/users/brand-new-user" with + | key | additional_mail | + | value | no.reply@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 | additional_mail | + | value | noreply@nextcloud.com | + And the OCS status code should be "100" + And the HTTP status code should be "200" + When sending "PUT" to "/cloud/users/brand-new-user/additional_mail" with + | key | no.reply@nextcloud.com | + | value | | + And the OCS status code should be "100" + And the HTTP status code should be "200" + Then user "brand-new-user" has + | additional_mail | noreply@nextcloud.com | + Then user "brand-new-user" has not + | additional_mail | no.reply@nextcloud.com | + Scenario: An admin cannot edit user account property scopes Given As an "admin" And user "brand-new-user" exists @@ -233,7 +311,7 @@ Feature: provisioning And group "new-group" exists And group "new-group" has | displayname | new-group | - + Scenario: Create a group with custom display name Given As an "admin" And group "new-group" does not exist diff --git a/build/update-apps.sh b/build/update-apps.sh index e4611a79aff..57ee6dd5e08 100755 --- a/build/update-apps.sh +++ b/build/update-apps.sh @@ -1,14 +1,14 @@ #!/bin/bash -# Update Nextcloud apps from latest git master +# Update Nextcloud apps from latest git stable22 # For local development environment # Use from Nextcloud server folder with `./build/update-apps.sh` # # It automatically: # - goes through all apps which are not shipped via server # - shows the app name in bold and uses whitespace for separation -# - changes to master and pulls quietly +# - changes to stable22 and pulls quietly # - shows the 3 most recent commits for context -# - removes branches merged into master +# - removes branches merged into stable22 # - … could even do the build steps if they are consistent for the apps (like `make`) -find apps* -maxdepth 2 -name .git -exec sh -c 'cd {}/../ && printf "\n\033[1m${PWD##*/}\033[0m\n" && git checkout master && git pull --quiet -p && git --no-pager log -3 --pretty=format:"%h %Cblue%ar%x09%an %Creset%s" && printf "\n" && git branch --merged master | grep -v "master$" | xargs git branch -d && cd ..' \; +find apps* -maxdepth 2 -name .git -exec sh -c 'cd {}/../ && printf "\n\033[1m${PWD##*/}\033[0m\n" && git checkout stable22 && git pull --quiet -p && git --no-pager log -3 --pretty=format:"%h %Cblue%ar%x09%an %Creset%s" && printf "\n" && git branch --merged stable22 | grep -v "stable22$" | xargs git branch -d && cd ..' \; diff --git a/build/update.sh b/build/update.sh index 3a3d2eac5dc..1e8552ae296 100755 --- a/build/update.sh +++ b/build/update.sh @@ -1,15 +1,15 @@ #!/bin/bash -# Update Nextcloud server and apps from latest git master +# Update Nextcloud server and apps from latest git stable22 # For local development environment # Use from Nextcloud server folder with `./build/update.sh` # Update server printf "\n\033[1m${PWD##*/}\033[0m\n" -git checkout master +git checkout stable22 git pull --quiet -p git --no-pager log -3 --pretty=format:"%h %Cblue%ar%x09%an %Creset%s" printf "\n" -git branch --merged master | grep -v "master$" | xargs git branch -d +git branch --merged stable22 | grep -v "stable22$" | xargs git branch -d git submodule update --init # Update apps |