From 3a50f86ceec73dd370b621dd19410a8da6e222c3 Mon Sep 17 00:00:00 2001 From: mibe Date: Fri, 4 Oct 2024 13:18:58 +0100 Subject: [PATCH] #75 Added a unit test for language_container_deployer_cli --- .github/workflows/run-tests.yml | 2 +- doc/changes/unreleased.md | 2 ++ .../cli/bucketfs_conn_object_cli.py | 6 +++--- test/unit/cli/test_bucketfs_conn_object_cli.py | 12 ++++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 test/unit/cli/test_bucketfs_conn_object_cli.py diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f75447a..13edace 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -40,4 +40,4 @@ jobs: SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }} SAAS_PAT: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_PAT }} run: - poetry run nox -s integration-tests -- -- --db-version ${{ inputs.exasol-version}} --backend all + poetry run nox -s integration-tests -- -- --db-version ${{ inputs.exasol-version}} --backend onprem diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index f7ee722..b1eab54 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -5,6 +5,8 @@ * #66: Implemented a standard CLI options builder. * #70: Implemented a CLI callback function for the language container deployment. * #69: Added create_bucketfs_location function. +* #75: Added create_bucketfs_location_from_conn_object function. +* #74: Implemented a CLI callback function for creating a bucket-fs connection object. # Refactoring diff --git a/exasol/python_extension_common/cli/bucketfs_conn_object_cli.py b/exasol/python_extension_common/cli/bucketfs_conn_object_cli.py index 60a7b34..434fb7f 100644 --- a/exasol/python_extension_common/cli/bucketfs_conn_object_cli.py +++ b/exasol/python_extension_common/cli/bucketfs_conn_object_cli.py @@ -1,5 +1,4 @@ -from exasol.python_extension_common.connections.bucketfs_location import ( - create_bucketfs_conn_object) +import exasol.python_extension_common.connections.bucketfs_location as bl class BucketfsConnObjectCli: @@ -7,4 +6,5 @@ def __init__(self, conn_name_arg: str): self._conn_name_arg = conn_name_arg def __call__(self, **kwargs): - create_bucketfs_conn_object(conn_name=self._conn_name_arg, **kwargs) + conn_name = kwargs.pop(self._conn_name_arg) + bl.create_bucketfs_conn_object(conn_name=conn_name, **kwargs) diff --git a/test/unit/cli/test_bucketfs_conn_object_cli.py b/test/unit/cli/test_bucketfs_conn_object_cli.py new file mode 100644 index 0000000..d54226a --- /dev/null +++ b/test/unit/cli/test_bucketfs_conn_object_cli.py @@ -0,0 +1,12 @@ +from unittest.mock import patch + +from exasol.python_extension_common.cli.bucketfs_conn_object_cli import BucketfsConnObjectCli + + +@patch('exasol.python_extension_common.connections.bucketfs_location.create_bucketfs_conn_object') +def test_bucketfs_conn_object_cli(create_con_object_mock): + conn_name = 'my_conn_name' + fake_params = {'x': 'xxx', 'y': 'yyy'} + conn_object_callback = BucketfsConnObjectCli('conn_name') + conn_object_callback(conn_name=conn_name, **fake_params) + assert create_con_object_mock.called_once_with(conn_name, **fake_params)