From c82b07ecdec74b67e9cf20997bae541660d5b793 Mon Sep 17 00:00:00 2001 From: mibe Date: Tue, 8 Oct 2024 12:33:12 +0100 Subject: [PATCH] #61 Added cli_args fixture --- .../exasol/pytest_extension/__init__.py | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/pytest-extension/exasol/pytest_extension/__init__.py b/pytest-extension/exasol/pytest_extension/__init__.py index 5367300..73131da 100644 --- a/pytest-extension/exasol/pytest_extension/__init__.py +++ b/pytest-extension/exasol/pytest_extension/__init__.py @@ -150,12 +150,17 @@ def bucketfs_std_params(backend, to the BucketFS on either DockerDB or SaaS test database. """ if backend == BACKEND_ONPREM: - return onprem_bucketfs_std_params + bfs_std_params = onprem_bucketfs_std_params elif backend == BACKEND_SAAS: - return saas_std_params + bfs_std_params = saas_std_params else: ValueError(f'Unknown backend {backend}') + # Work around for the bug in PEC (Issue#78 - no default for the StdParams.path_in_bucket) + if StdParams.path_in_bucket.name not in bfs_std_params: + bfs_std_params[StdParams.path_in_bucket.name] = '' + return bfs_std_params + def _cli_params_to_args(cli_params) -> str: def arg_string(k: str, v: Any): @@ -180,8 +185,14 @@ def bucketfs_cli_args(bucketfs_std_params) -> str: """ CLI argument string for testing a command that involves connecting to the BucketFS . """ - cli_args = _cli_params_to_args(bucketfs_std_params) - # Work around for the bug in PEC (Issue#78 - no default for the StdParams.path_in_bucket) - if StdParams.path_in_bucket not in bucketfs_std_params: - cli_args += f' --{StdParams.path_in_bucket.name.replace("_", "-")} ""' - return cli_args + return _cli_params_to_args(bucketfs_std_params) + + +def cli_args(database_std_params, bucketfs_std_params): + """ + CLI argument string for testing a command that involves connecting to both + the database and the BucketFS. + """ + std_params = dict(database_std_params) + std_params.update(bucketfs_std_params) + return _cli_params_to_args(database_std_params)