summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-12 11:51:37 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-16 15:37:12 +0100
commitaadd0ab2c5cad9fe09d000e730c8019b17cf36b1 (patch)
tree9f2a26e0fb414a89988739d9166261a5a9cbf8ec
parent68f67d9c9ec53e45d6589e3c7f4039f745d29276 (diff)
downloadnextcloud-server-aadd0ab2c5cad9fe09d000e730c8019b17cf36b1.tar.gz
nextcloud-server-aadd0ab2c5cad9fe09d000e730c8019b17cf36b1.zip
Reset app configs by deleting the values instead of setting the defaults
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>
-rw-r--r--build/integration/features/bootstrap/AppConfiguration.php13
-rw-r--r--build/integration/features/bootstrap/CapabilitiesContext.php22
-rw-r--r--build/integration/features/bootstrap/FederationContext.php4
-rw-r--r--build/integration/features/bootstrap/ShareesContext.php6
-rw-r--r--build/integration/features/bootstrap/SharingContext.php4
5 files changed, 31 insertions, 18 deletions
diff --git a/build/integration/features/bootstrap/AppConfiguration.php b/build/integration/features/bootstrap/AppConfiguration.php
index 23ce2f89d04..b907abae2aa 100644
--- a/build/integration/features/bootstrap/AppConfiguration.php
+++ b/build/integration/features/bootstrap/AppConfiguration.php
@@ -71,6 +71,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');
diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php
index 1de5001d136..a7a8c79e442 100644
--- a/build/integration/features/bootstrap/CapabilitiesContext.php
+++ b/build/integration/features/bootstrap/CapabilitiesContext.php
@@ -66,16 +66,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');
}
}
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php
index 092f0326d3a..a4a755a7ca4 100644
--- a/build/integration/features/bootstrap/FederationContext.php
+++ b/build/integration/features/bootstrap/FederationContext.php
@@ -99,7 +99,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');
}
}
diff --git a/build/integration/features/bootstrap/ShareesContext.php b/build/integration/features/bootstrap/ShareesContext.php
index 4042bb64f5c..e9c5b65c98b 100644
--- a/build/integration/features/bootstrap/ShareesContext.php
+++ b/build/integration/features/bootstrap/ShareesContext.php
@@ -40,8 +40,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');
}
}
diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php
index 29c91501eff..d656b776a39 100644
--- a/build/integration/features/bootstrap/SharingContext.php
+++ b/build/integration/features/bootstrap/SharingContext.php
@@ -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');
}
}