qbraid-cli 0.10.7__tar.gz → 0.10.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qbraid-cli might be problematic. Click here for more details.
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/bump-version.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/ci-pr-target.yml +3 -3
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/docs-pr.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/docs.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/format.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/main.yml +3 -3
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/pre-release.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/publish.yml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/PKG-INFO +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/pyproject.toml +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/account/app.py +3 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/configure/actions.py +13 -6
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/PKG-INFO +1 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/SOURCES.txt +0 -1
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/account/test_account_credits.py +0 -2
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/configure/test_configure_commands.py +26 -2
- qbraid_cli-0.10.8/tests/configure/test_configure_default.py +61 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/configure/test_configure_prompt_for_config.py +1 -3
- qbraid_cli-0.10.7/qbraid_cli/_version.py +0 -21
- qbraid_cli-0.10.7/tests/configure/test_configure_default.py +0 -54
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.env.example +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/dependabot.yml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.github/workflows/tag-on-merge.yml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.gitignore +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/.readthedocs.yml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/CONTRIBUTING.md +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/LICENSE +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/MANIFEST.IN +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/Makefile +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/README.md +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/Makefile +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/_static/favicon.ico +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/_static/logo.png +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/_static/style/custom.css +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/_static/style/s4defs-roles.css +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/conf.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/index.rst +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/make.bat +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/docs/requirements.txt +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/account/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/admin/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/admin/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/admin/headers.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/admin/validation.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/chat/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/chat/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/configure/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/configure/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/devices/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/devices/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/devices/validation.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/envs/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/envs/activate.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/envs/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/envs/create.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/envs/data_handling.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/exceptions.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/files/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/files/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/handlers.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/jobs/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/jobs/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/jobs/toggle_braket.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/jobs/validation.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/kernels/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/kernels/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/main.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/pip/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/pip/app.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/pip/hooks.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli/py.typed +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/dependency_links.txt +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/entry_points.txt +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/requires.txt +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/qbraid_cli.egg-info/top_level.txt +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/setup.cfg +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/account/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/admin/test_headers.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/configure/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/configure/test_configure_set.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/configure/test_configure_validate_input.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/conftest.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/devices/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/devices/test_devices_get.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/devices/test_devices_list.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/devices/test_devices_validations.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_activate.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_activate_find_shell_rc.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_activate_print_command.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_activate_pyenv.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_create_from_yaml.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_list.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/envs/test_envs_remove.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/files/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/files/test_files_commands.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_disable.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_enable.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_get.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_list.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_state.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_toggle_braket_confirm.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_toggle_braket_disable.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_toggle_braket_enable.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_toggle_braket_get_data.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_validate_get_state.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_validate_handle_state.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/jobs/test_jobs_validate_library.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/kernels/__init__.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/kernels/test_kernels_list.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/resources/envs/correct.yaml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/resources/envs/icon.png +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tests/resources/envs/incorrect.yaml +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/bump_version.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/create_dev_build.sh +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/install_wheel_extras.sh +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/split_md.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/split_rst.py +0 -0
- {qbraid_cli-0.10.7 → qbraid_cli-0.10.8}/tools/stamp_pre_release.py +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
steps:
|
|
17
17
|
- uses: actions/checkout@v5
|
|
18
18
|
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@v6
|
|
20
20
|
with:
|
|
21
21
|
python-version: ${{ matrix.python-version }}
|
|
22
22
|
cache: pip
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
steps:
|
|
47
47
|
- uses: actions/checkout@v5
|
|
48
48
|
- name: Set up Python ${{ matrix.python-version }}
|
|
49
|
-
uses: actions/setup-python@
|
|
49
|
+
uses: actions/setup-python@v6
|
|
50
50
|
with:
|
|
51
51
|
python-version: ${{ matrix.python-version }}
|
|
52
52
|
cache: pip
|
|
@@ -73,7 +73,7 @@ jobs:
|
|
|
73
73
|
QBRAID_API_KEY: ${{ secrets.QBRAID_API_KEY }}
|
|
74
74
|
- name: Upload coverage to Codecov
|
|
75
75
|
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
|
|
76
|
-
uses: codecov/codecov-action@v5.
|
|
76
|
+
uses: codecov/codecov-action@v5.5.1
|
|
77
77
|
with:
|
|
78
78
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
79
79
|
fail_ci_if_error: false
|
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
steps:
|
|
20
20
|
- uses: actions/checkout@v5
|
|
21
21
|
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
-
uses: actions/setup-python@
|
|
22
|
+
uses: actions/setup-python@v6
|
|
23
23
|
with:
|
|
24
24
|
python-version: ${{ matrix.python-version }}
|
|
25
25
|
cache: pip
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
steps:
|
|
50
50
|
- uses: actions/checkout@v5
|
|
51
51
|
- name: Set up Python ${{ matrix.python-version }}
|
|
52
|
-
uses: actions/setup-python@
|
|
52
|
+
uses: actions/setup-python@v6
|
|
53
53
|
with:
|
|
54
54
|
python-version: ${{ matrix.python-version }}
|
|
55
55
|
cache: pip
|
|
@@ -76,7 +76,7 @@ jobs:
|
|
|
76
76
|
QBRAID_API_KEY: ${{ secrets.QBRAID_API_KEY }}
|
|
77
77
|
- name: Upload coverage to Codecov
|
|
78
78
|
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
|
|
79
|
-
uses: codecov/codecov-action@v5.
|
|
79
|
+
uses: codecov/codecov-action@v5.5.1
|
|
80
80
|
with:
|
|
81
81
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
82
82
|
fail_ci_if_error: false
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qbraid-cli"
|
|
7
|
-
version = "0.10.
|
|
7
|
+
version = "0.10.8"
|
|
8
8
|
description = "Command Line Interface for interacting with all parts of the qBraid platform."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "qBraid Development Team", email = "contact@qbraid.com" }]
|
|
@@ -11,6 +11,7 @@ from typing import Any
|
|
|
11
11
|
import rich
|
|
12
12
|
import typer
|
|
13
13
|
|
|
14
|
+
from qbraid_cli.configure.actions import QBRAID_ORG_MODEL_ENABLED
|
|
14
15
|
from qbraid_cli.handlers import run_progress_task
|
|
15
16
|
|
|
16
17
|
account_app = typer.Typer(help="Manage qBraid account.", no_args_is_help=True)
|
|
@@ -51,9 +52,10 @@ def account_info():
|
|
|
51
52
|
"email": user.get("email"),
|
|
52
53
|
"joinedDate": user.get("createdAt", "Unknown"),
|
|
53
54
|
"activePlan": user.get("activePlan", "") or "Free",
|
|
54
|
-
"organization": personal_info.get("organization", "") or "qbraid",
|
|
55
55
|
"role": personal_info.get("role", "") or "guest",
|
|
56
56
|
}
|
|
57
|
+
if QBRAID_ORG_MODEL_ENABLED:
|
|
58
|
+
metadata["organization"] = personal_info.get("organization", "") or "qbraid"
|
|
57
59
|
|
|
58
60
|
return metadata
|
|
59
61
|
|
|
@@ -25,6 +25,8 @@ from rich.console import Console
|
|
|
25
25
|
|
|
26
26
|
from qbraid_cli.handlers import handle_filesystem_operation
|
|
27
27
|
|
|
28
|
+
QBRAID_ORG_MODEL_ENABLED = False # Set to True if organization/workspace model is enabled
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
def validate_input(key: str, value: str) -> str:
|
|
30
32
|
"""Validate the user input based on the key.
|
|
@@ -96,16 +98,21 @@ def default_action(section: str = DEFAULT_CONFIG_SECTION):
|
|
|
96
98
|
|
|
97
99
|
default_values = {
|
|
98
100
|
"url": DEFAULT_ENDPOINT_URL,
|
|
99
|
-
"organization": DEFAULT_ORGANIZATION,
|
|
100
|
-
"workspace": DEFAULT_WORKSPACE,
|
|
101
101
|
}
|
|
102
|
+
if QBRAID_ORG_MODEL_ENABLED:
|
|
103
|
+
default_values["organization"] = DEFAULT_ORGANIZATION
|
|
104
|
+
default_values["workspace"] = DEFAULT_WORKSPACE
|
|
102
105
|
|
|
103
106
|
config[section]["url"] = prompt_for_config(config, section, "url", default_values)
|
|
104
107
|
config[section]["api-key"] = prompt_for_config(config, section, "api-key", default_values)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
|
|
109
|
+
if QBRAID_ORG_MODEL_ENABLED:
|
|
110
|
+
config[section]["organization"] = prompt_for_config(
|
|
111
|
+
config, section, "organization", default_values
|
|
112
|
+
)
|
|
113
|
+
config[section]["workspace"] = prompt_for_config(
|
|
114
|
+
config, section, "workspace", default_values
|
|
115
|
+
)
|
|
109
116
|
|
|
110
117
|
for key in list(config[section]):
|
|
111
118
|
if not config[section][key]:
|
|
@@ -51,7 +51,6 @@ def test_account_info_success():
|
|
|
51
51
|
"email": "mock@example.com",
|
|
52
52
|
"joinedDate": "2022-03-10T03:52:08.743Z",
|
|
53
53
|
"activePlan": "Free",
|
|
54
|
-
"organization": "qbraid",
|
|
55
54
|
"role": "guest",
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -66,7 +65,6 @@ def test_account_info_success():
|
|
|
66
65
|
"email": "mock@example.com",
|
|
67
66
|
"createdAt": "2022-03-10T03:52:08.743Z",
|
|
68
67
|
"activePlan": "Free",
|
|
69
|
-
"organization": "qbraid",
|
|
70
68
|
"role": "guest",
|
|
71
69
|
}
|
|
72
70
|
|
|
@@ -41,7 +41,6 @@ def test_configure_list_with_values(capsys):
|
|
|
41
41
|
"api-key": "abcdef123456",
|
|
42
42
|
"refresh-token": "xyz987654321",
|
|
43
43
|
"url": "https://example.com",
|
|
44
|
-
"organization": "test-org",
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
mock_load_config = MagicMock(return_value=mock_config)
|
|
@@ -55,7 +54,32 @@ def test_configure_list_with_values(capsys):
|
|
|
55
54
|
assert "*****321" in captured.out # last 3 chars of refresh-token
|
|
56
55
|
# Check that non-sensitive values are shown in full
|
|
57
56
|
assert "https://example.com" in captured.out
|
|
58
|
-
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_configure_list_with_org_enabled_config(capsys):
|
|
60
|
+
"""Test configure_list with organization and workspace when org model is enabled."""
|
|
61
|
+
mock_config = {
|
|
62
|
+
"default": {
|
|
63
|
+
"api-key": "abcdef123456",
|
|
64
|
+
"refresh-token": "xyz987654321",
|
|
65
|
+
"url": "https://example.com",
|
|
66
|
+
"organization": "my-org",
|
|
67
|
+
"workspace": "my-workspace",
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
mock_load_config = MagicMock(return_value=mock_config)
|
|
71
|
+
with patch("qbraid_cli.configure.actions.QBRAID_ORG_MODEL_ENABLED", True):
|
|
72
|
+
with patch("qbraid_core.config.load_config", mock_load_config):
|
|
73
|
+
configure_list()
|
|
74
|
+
captured = capsys.readouterr()
|
|
75
|
+
|
|
76
|
+
# Check that sensitive values are masked
|
|
77
|
+
assert "*****456" in captured.out # last 3 chars of api-key
|
|
78
|
+
assert "*****321" in captured.out # last 3 chars of refresh-token
|
|
79
|
+
# Check that non-sensitive values are shown in full
|
|
80
|
+
assert "https://example.com" in captured.out
|
|
81
|
+
assert "my-org" in captured.out
|
|
82
|
+
assert "my-workspace" in captured.out
|
|
59
83
|
|
|
60
84
|
|
|
61
85
|
def test_configure_get_success(capsys):
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Unit tests for the default_action function in the configure app.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import configparser
|
|
10
|
+
from unittest.mock import patch
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from qbraid_cli.configure.actions import default_action
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.mark.parametrize(
|
|
18
|
+
"org_model_enabled,side_effect,expected_call_count",
|
|
19
|
+
[
|
|
20
|
+
(False, ["https://new.example.com", "api-key-123"], 2),
|
|
21
|
+
(True, ["https://api.qbraid.com", "api-key-456", "qbraid-org", "default-workspace"], 4),
|
|
22
|
+
],
|
|
23
|
+
)
|
|
24
|
+
def test_default_action(org_model_enabled, side_effect, expected_call_count):
|
|
25
|
+
"""Test default_action method with mocked dependencies."""
|
|
26
|
+
# Store original value of QBRAID_ORG_MODEL_ENABLED
|
|
27
|
+
import qbraid_cli.configure.actions as actions_module
|
|
28
|
+
|
|
29
|
+
original_org_model_enabled = actions_module.QBRAID_ORG_MODEL_ENABLED
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
# Set the org model enabled flag for this test
|
|
33
|
+
actions_module.QBRAID_ORG_MODEL_ENABLED = org_model_enabled
|
|
34
|
+
|
|
35
|
+
with (
|
|
36
|
+
patch("qbraid_cli.configure.actions.load_config") as mock_load_config,
|
|
37
|
+
patch("qbraid_cli.configure.actions.prompt_for_config") as mock_prompt,
|
|
38
|
+
patch("qbraid_cli.configure.actions.handle_filesystem_operation") as mock_handle_fs,
|
|
39
|
+
patch("qbraid_cli.configure.actions.Console") as mock_console,
|
|
40
|
+
):
|
|
41
|
+
# Setup mock returns
|
|
42
|
+
config = configparser.ConfigParser()
|
|
43
|
+
config.add_section("default")
|
|
44
|
+
mock_load_config.return_value = config
|
|
45
|
+
mock_prompt.side_effect = side_effect
|
|
46
|
+
mock_console_instance = mock_console.return_value
|
|
47
|
+
|
|
48
|
+
# Call the function to test
|
|
49
|
+
default_action()
|
|
50
|
+
|
|
51
|
+
# Verify prompt_for_config was called the expected number of times
|
|
52
|
+
assert mock_prompt.call_count == expected_call_count
|
|
53
|
+
mock_load_config.assert_called_once()
|
|
54
|
+
mock_handle_fs.assert_called_once()
|
|
55
|
+
mock_console_instance.print.assert_called_once_with(
|
|
56
|
+
"\n[bold green]Configuration updated successfully."
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
finally:
|
|
60
|
+
# Restore original value
|
|
61
|
+
actions_module.QBRAID_ORG_MODEL_ENABLED = original_org_model_enabled
|
|
@@ -9,7 +9,7 @@ Unit tests for the prompt_for_config function in the configure app.
|
|
|
9
9
|
import configparser
|
|
10
10
|
from unittest.mock import patch
|
|
11
11
|
|
|
12
|
-
from qbraid_cli.configure.actions import
|
|
12
|
+
from qbraid_cli.configure.actions import prompt_for_config
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def test_enter_new_values():
|
|
@@ -20,8 +20,6 @@ def test_enter_new_values():
|
|
|
20
20
|
# Initial values
|
|
21
21
|
settings = [
|
|
22
22
|
("url", "http://example.com", "http://newexample.com"),
|
|
23
|
-
("organization", "default-org", "new-org"),
|
|
24
|
-
("workspace", "default-workspace", "new-workspace"),
|
|
25
23
|
]
|
|
26
24
|
|
|
27
25
|
# Setup config with initial values
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools-scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
|
|
4
|
-
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
-
|
|
6
|
-
TYPE_CHECKING = False
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from typing import Tuple
|
|
9
|
-
from typing import Union
|
|
10
|
-
|
|
11
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
-
else:
|
|
13
|
-
VERSION_TUPLE = object
|
|
14
|
-
|
|
15
|
-
version: str
|
|
16
|
-
__version__: str
|
|
17
|
-
__version_tuple__: VERSION_TUPLE
|
|
18
|
-
version_tuple: VERSION_TUPLE
|
|
19
|
-
|
|
20
|
-
__version__ = version = '0.1.dev1+g494c7ce'
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 1, 'dev1', 'g494c7ce')
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024, qBraid Development Team
|
|
2
|
-
# All rights reserved.
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
Unit tests for the default_action function in the configure app.
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
import configparser
|
|
10
|
-
from unittest.mock import patch
|
|
11
|
-
|
|
12
|
-
from qbraid_cli.configure.actions import default_action
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def test_default_action():
|
|
16
|
-
"""Test default_action method with mocked dependencies."""
|
|
17
|
-
with (
|
|
18
|
-
patch("qbraid_cli.configure.actions.load_config") as mock_load_config,
|
|
19
|
-
patch("qbraid_cli.configure.actions.prompt_for_config") as mock_prompt,
|
|
20
|
-
patch("qbraid_cli.configure.actions.handle_filesystem_operation") as mock_handle_fs,
|
|
21
|
-
patch("qbraid_cli.configure.actions.Console") as mock_console,
|
|
22
|
-
):
|
|
23
|
-
# Setup mock returns
|
|
24
|
-
config = configparser.ConfigParser()
|
|
25
|
-
config.add_section("default")
|
|
26
|
-
mock_load_config.return_value = config
|
|
27
|
-
|
|
28
|
-
# Setup prompt_for_config to return different values
|
|
29
|
-
mock_prompt.side_effect = [
|
|
30
|
-
"https://new.example.com", # url
|
|
31
|
-
"api-key-123", # api-key
|
|
32
|
-
"new-organization", # organization
|
|
33
|
-
"new-workspace", # workspace
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
# Create mock console
|
|
37
|
-
mock_console_instance = mock_console.return_value
|
|
38
|
-
|
|
39
|
-
# Call the function to test
|
|
40
|
-
default_action()
|
|
41
|
-
|
|
42
|
-
# Verify config load/save was called
|
|
43
|
-
mock_load_config.assert_called_once()
|
|
44
|
-
|
|
45
|
-
# Verify prompt_for_config was called 4 times
|
|
46
|
-
assert mock_prompt.call_count == 4
|
|
47
|
-
|
|
48
|
-
# Verify handle_filesystem_operation was called to save config
|
|
49
|
-
mock_handle_fs.assert_called_once()
|
|
50
|
-
|
|
51
|
-
# Verify console.print was called with success message
|
|
52
|
-
mock_console_instance.print.assert_called_once_with(
|
|
53
|
-
"\n[bold green]Configuration updated successfully."
|
|
54
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|