]> source.dussan.org Git - nextcloud-server.git/commitdiff
Reset app configs by deleting the values instead of setting the defaults
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 12 Nov 2020 10:51:37 +0000 (11:51 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 16 Nov 2020 13:17:00 +0000 (13:17 +0000)
This avoids the need to keep the default values in the integration tests
in sync with the code, and also makes possible to reset values with
"dynamic" defaults (defaults that depend on other values).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
build/integration/features/bootstrap/AppConfiguration.php
build/integration/features/bootstrap/CapabilitiesContext.php
build/integration/features/bootstrap/FederationContext.php
build/integration/features/bootstrap/ShareesContext.php
build/integration/features/bootstrap/SharingContext.php

index b893637ba6cabd4d2329fff35b7aa3d7fd75c8cf..fe8308fd59bfc53adeea2b77325850b5d536d506 100644 (file)
@@ -72,6 +72,19 @@ trait AppConfiguration {
                }
        }
 
+       /**
+        * @param string $app
+        * @param string $parameter
+        * @param string $value
+        */
+       protected function deleteServerConfig($app, $parameter) {
+               $this->sendingTo('DELETE', "/apps/testing/api/v1/app/{$app}/{$parameter}");
+               $this->theHTTPStatusCodeShouldBe('200');
+               if ($this->apiVersion === 1) {
+                       $this->theOCSStatusCodeShouldBe('100');
+               }
+       }
+
        protected function setStatusTestingApp($enabled) {
                $this->sendingTo(($enabled ? 'post' : 'delete'), '/cloud/apps/testing');
                $this->theHTTPStatusCodeShouldBe('200');
index 19da7bc62c1763064c0f69259a96ff37b6f7aae7..7d450fa9cd507677153a3c19110ff33194a15dcd 100644 (file)
@@ -61,16 +61,16 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext {
        }
 
        protected function resetAppConfigs() {
-               $this->modifyServerConfig('core', 'shareapi_enabled', 'yes');
-               $this->modifyServerConfig('core', 'shareapi_allow_links', 'yes');
-               $this->modifyServerConfig('core', 'shareapi_allow_public_upload', 'yes');
-               $this->modifyServerConfig('core', 'shareapi_allow_resharing', 'yes');
-               $this->modifyServerConfig('files_sharing', 'outgoing_server2server_share_enabled', 'yes');
-               $this->modifyServerConfig('files_sharing', 'incoming_server2server_share_enabled', 'yes');
-               $this->modifyServerConfig('core', 'shareapi_enforce_links_password', 'no');
-               $this->modifyServerConfig('core', 'shareapi_allow_public_notification', 'no');
-               $this->modifyServerConfig('core', 'shareapi_default_expire_date', 'no');
-               $this->modifyServerConfig('core', 'shareapi_enforce_expire_date', 'no');
-               $this->modifyServerConfig('core', 'shareapi_allow_group_sharing', 'yes');
+               $this->deleteServerConfig('core', 'shareapi_enabled');
+               $this->deleteServerConfig('core', 'shareapi_allow_links');
+               $this->deleteServerConfig('core', 'shareapi_allow_public_upload');
+               $this->deleteServerConfig('core', 'shareapi_allow_resharing');
+               $this->deleteServerConfig('files_sharing', 'outgoing_server2server_share_enabled');
+               $this->deleteServerConfig('files_sharing', 'incoming_server2server_share_enabled');
+               $this->deleteServerConfig('core', 'shareapi_enforce_links_password');
+               $this->deleteServerConfig('core', 'shareapi_allow_public_notification');
+               $this->deleteServerConfig('core', 'shareapi_default_expire_date');
+               $this->deleteServerConfig('core', 'shareapi_enforce_expire_date');
+               $this->deleteServerConfig('core', 'shareapi_allow_group_sharing');
        }
 }
index 13e0de46187208f9f7189761babcb3db8d4ccb54..e119f950a46640d45da3135f19549566edbe8ebe 100644 (file)
@@ -97,7 +97,7 @@ class FederationContext implements Context, SnippetAcceptingContext {
        }
 
        protected function resetAppConfigs() {
-               $this->modifyServerConfig('files_sharing', 'incoming_server2server_group_share_enabled', 'no');
-               $this->modifyServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled', 'no');
+               $this->deleteServerConfig('files_sharing', 'incoming_server2server_group_share_enabled');
+               $this->deleteServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled');
        }
 }
index 64896a820095f92b308e7882e05afa00a9405e19..adfc63c0634976edd1390142bdea403ef9b261d4 100644 (file)
@@ -36,8 +36,8 @@ class ShareesContext implements Context, SnippetAcceptingContext {
        use AppConfiguration;
 
        protected function resetAppConfigs() {
-               $this->modifyServerConfig('core', 'shareapi_only_share_with_group_members', 'no');
-               $this->modifyServerConfig('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes');
-               $this->modifyServerConfig('core', 'shareapi_allow_group_sharing', 'yes');
+               $this->deleteServerConfig('core', 'shareapi_only_share_with_group_members');
+               $this->deleteServerConfig('core', 'shareapi_allow_share_dialog_user_enumeration');
+               $this->deleteServerConfig('core', 'shareapi_allow_group_sharing');
        }
 }
index 447b8f1c0246677b823adffede28078e90c1f6cc..2fcca2ee2c72c6e5ab2e8f448272b00a58f60d40 100644 (file)
@@ -37,7 +37,7 @@ class SharingContext implements Context, SnippetAcceptingContext {
        use CommandLine;
 
        protected function resetAppConfigs() {
-               $this->modifyServerConfig('core', 'shareapi_default_permissions', '31');
-               $this->modifyServerConfig('sharebymail', 'enforcePasswordProtection', 'no');
+               $this->deleteServerConfig('core', 'shareapi_default_permissions');
+               $this->deleteServerConfig('sharebymail', 'enforcePasswordProtection');
        }
 }