Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaw-jan <saw.jan.grg3e@gmail.com>2022-09-20 14:01:12 +0300
committerSawjan Gurung <saw.jan.grg3e@gmail.com>2022-11-03 12:09:58 +0300
commit33db85b591421991e2f9355859c5e59c0b72ea52 (patch)
tree5f9633c4209e90cafcce4359ea358683beba8f78
parentb676c52da919f4c5c3ba0b3e641f43941a30274d (diff)
make env vars to have higher priority in the config
-rw-r--r--test/gui/shared/scripts/bdd_hooks.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py
index 5acdf4318..227f7be37 100644
--- a/test/gui/shared/scripts/bdd_hooks.py
+++ b/test/gui/shared/scripts/bdd_hooks.py
@@ -53,7 +53,7 @@ def hook(context):
'guiTestReportDir': 'GUI_TEST_REPORT_DIR',
}
- DEFAULT_CONFIG = {
+ context.userData = {
'localBackendUrl': 'https://localhost:9200/',
'secureLocalBackendUrl': 'https://localhost:9200/',
'maxSyncTimeout': 60,
@@ -67,32 +67,34 @@ def hook(context):
'guiTestReportDir': os.path.abspath('../reports/'),
}
- # read configs from environment variables
- context.userData = {}
- for key, value in CONFIG_ENV_MAP.items():
- context.userData[key] = os.environ.get(value, '')
-
# try reading configs from config.ini
cfg = ConfigParser()
try:
if cfg.read('../config.ini'):
- for key, value in context.userData.items():
- if value == '':
- context.userData[key] = cfg.get('DEFAULT', CONFIG_ENV_MAP[key])
+ for key, _ in context.userData.items():
+ if key in CONFIG_ENV_MAP:
+ value = cfg.get('DEFAULT', CONFIG_ENV_MAP[key])
+ if value:
+ context.userData[key] = value
except Exception as err:
test.log(str(err))
+ # read and override configs from environment variables
+ for key, value in CONFIG_ENV_MAP.items():
+ if os.environ.get(value):
+ context.userData[key] = os.environ.get(value)
+
# Set the default values if empty
for key, value in context.userData.items():
- if value == '':
- context.userData[key] = DEFAULT_CONFIG[key]
- elif key == 'maxSyncTimeout' or key == 'minSyncTimeout':
+ if key == 'maxSyncTimeout' or key == 'minSyncTimeout':
context.userData[key] = builtins.int(value)
elif (
key == 'clientRootSyncPath'
- or 'tempFolderPath'
- or 'clientConfigDir'
- or 'guiTestReportDir'
+ or key == 'tempFolderPath'
+ or key == 'clientConfigDir'
+ or key == 'guiTestReportDir'
+ or key == 'localBackendUrl'
+ or key == 'middlewareUrl'
):
# make sure there is always one trailing slash
context.userData[key] = value.rstrip('/') + '/'