testzeus-cli 0.0.21__tar.gz → 0.0.23__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.
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/PKG-INFO +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/pyproject.toml +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/device_pool.py +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/environments.py +8 -10
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/extensions.py +4 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/hypermind_code_blocks.py +7 -12
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/knowledge_bases.py +4 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/notification_channels.py +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/tags.py +4 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_data.py +8 -10
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_report_schedules.py +4 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_run_groups.py +6 -6
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_runs.py +159 -9
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_node_runs.py +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_runs.py +4 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suite_schedules.py +3 -3
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/test_suites.py +11 -4
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests.py +9 -2
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests_ai_generator.py +1 -1
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/user_integrations.py +11 -5
- testzeus_cli-0.0.23/testzeus_cli/utils/files.py +45 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/formatters.py +61 -51
- testzeus_cli-0.0.23/testzeus_cli/utils/links.py +49 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/LICENSE +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/README.md +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/__init__.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/auth.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/cli.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/__init__.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/daemon.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/commands/tests_authoring.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/config.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/__init__.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/auth.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/client.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/profile.py +0 -0
- {testzeus_cli-0.0.21 → testzeus_cli-0.0.23}/testzeus_cli/utils/validators.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "testzeus-cli"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.23"
|
|
8
8
|
description = "Command-line interface for TestZeus testing platform"
|
|
9
9
|
authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -27,7 +27,7 @@ def device_pool_group():
|
|
|
27
27
|
@click.option(
|
|
28
28
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value, e.g. platform=android)"
|
|
29
29
|
)
|
|
30
|
-
@click.option("--sort", help="Sort by field (e.g. device_name, -platform_version)")
|
|
30
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field (e.g. device_name, -platform_version)")
|
|
31
31
|
@click.option("--page", default=1, help="Page number")
|
|
32
32
|
@click.option("--per-page", default=50, help="Items per page")
|
|
33
33
|
@click.pass_context
|
|
@@ -14,6 +14,8 @@ from testzeus_cli.config import get_client_config
|
|
|
14
14
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
15
15
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
16
16
|
from testzeus_cli.utils.validators import parse_key_value_pairs, validate_tenant_ownership
|
|
17
|
+
from testzeus_cli.utils.files import match_stored_file
|
|
18
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
17
19
|
|
|
18
20
|
console = Console()
|
|
19
21
|
|
|
@@ -220,7 +222,7 @@ def create(ctx, name, device_type, status, data, data_file, tags, connected_envi
|
|
|
220
222
|
@click.option(
|
|
221
223
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
222
224
|
)
|
|
223
|
-
@click.option("--sort", help="Sort by field")
|
|
225
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
224
226
|
@click.option("--expand", help="Expand related entities")
|
|
225
227
|
@click.pass_context
|
|
226
228
|
def list(ctx, filters, sort, expand):
|
|
@@ -243,6 +245,7 @@ def list(ctx, filters, sort, expand):
|
|
|
243
245
|
|
|
244
246
|
try:
|
|
245
247
|
result = asyncio.run(_run())
|
|
248
|
+
print_platform_link(ctx, "environments")
|
|
246
249
|
format_output(result, ctx.obj["FORMAT"])
|
|
247
250
|
except Exception as e:
|
|
248
251
|
print_message(f"[red]Error listing environments: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -302,6 +305,7 @@ def get(ctx, env_id, expand):
|
|
|
302
305
|
|
|
303
306
|
try:
|
|
304
307
|
result = asyncio.run(_run())
|
|
308
|
+
print_platform_link(ctx, "environments")
|
|
305
309
|
format_output(result, ctx.obj["FORMAT"])
|
|
306
310
|
except Exception as e:
|
|
307
311
|
print_message(f"[red]Error getting environment: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -652,15 +656,9 @@ def remove_file(ctx, env_id, file_path):
|
|
|
652
656
|
env_data = await client.environments.get_one(env_id)
|
|
653
657
|
validate_tenant_ownership(env_data.data, tenant_id, "environment")
|
|
654
658
|
|
|
655
|
-
file_name =
|
|
656
|
-
if
|
|
657
|
-
|
|
658
|
-
if (
|
|
659
|
-
file_path.split("/")[-1].split(".")[0].lower()
|
|
660
|
-
== file.split("_")[0].lower()
|
|
661
|
-
):
|
|
662
|
-
file_name = file
|
|
663
|
-
break
|
|
659
|
+
file_name = match_stored_file(env_data.supporting_data_files or [], file_path)
|
|
660
|
+
if not file_name:
|
|
661
|
+
raise ValueError(f"File not found in environment: {file_path}")
|
|
664
662
|
params = {
|
|
665
663
|
"supporting_data_files-": [file_name],
|
|
666
664
|
"tenant": tenant_id,
|
|
@@ -13,6 +13,7 @@ from testzeus_cli.config import get_client_config
|
|
|
13
13
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
14
14
|
from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
|
|
15
15
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
16
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
16
17
|
|
|
17
18
|
console = Console()
|
|
18
19
|
|
|
@@ -27,7 +28,7 @@ def extensions_group():
|
|
|
27
28
|
@click.option(
|
|
28
29
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
29
30
|
)
|
|
30
|
-
@click.option("--sort", help="Sort by field")
|
|
31
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
31
32
|
@click.option("--expand", help="Expand related entities (comma-separated)")
|
|
32
33
|
@click.option("--page", default=1, help="Page number")
|
|
33
34
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -55,6 +56,7 @@ def list_extensions(ctx, filters, sort, expand, page, per_page):
|
|
|
55
56
|
return extensions
|
|
56
57
|
|
|
57
58
|
result = asyncio.run(_run())
|
|
59
|
+
print_platform_link(ctx, "training-runs")
|
|
58
60
|
format_output(result, ctx.obj["FORMAT"])
|
|
59
61
|
|
|
60
62
|
|
|
@@ -85,6 +87,7 @@ def get_extension(ctx, extension_id, expand):
|
|
|
85
87
|
return extension.data
|
|
86
88
|
|
|
87
89
|
result = asyncio.run(_run())
|
|
90
|
+
print_platform_link(ctx, "training-runs")
|
|
88
91
|
format_output(result, ctx.obj["FORMAT"])
|
|
89
92
|
|
|
90
93
|
|
|
@@ -12,6 +12,8 @@ from testzeus_cli.config import get_client_config
|
|
|
12
12
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
13
13
|
from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
|
|
14
14
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
15
|
+
from testzeus_cli.utils.files import match_stored_file
|
|
16
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
15
17
|
from pocketbase.client import FileUpload
|
|
16
18
|
|
|
17
19
|
console = Console()
|
|
@@ -27,7 +29,7 @@ def hypermind_code_blocks_group():
|
|
|
27
29
|
@click.option(
|
|
28
30
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
29
31
|
)
|
|
30
|
-
@click.option("--sort", help="Sort by field")
|
|
32
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
31
33
|
@click.option("--expand", help="Expand related entities")
|
|
32
34
|
@click.pass_context
|
|
33
35
|
def list_hypermind_code_blocks(ctx, filters, sort, expand):
|
|
@@ -53,6 +55,7 @@ def list_hypermind_code_blocks(ctx, filters, sort, expand):
|
|
|
53
55
|
return code_blocks
|
|
54
56
|
|
|
55
57
|
result = asyncio.run(_run())
|
|
58
|
+
print_platform_link(ctx, "hypermind-code-blocks")
|
|
56
59
|
format_output(result, ctx.obj["FORMAT"])
|
|
57
60
|
|
|
58
61
|
|
|
@@ -82,6 +85,7 @@ def get_hypermind_code_block(ctx, code_block_id, expand):
|
|
|
82
85
|
return code_block.data
|
|
83
86
|
|
|
84
87
|
result = asyncio.run(_run())
|
|
88
|
+
print_platform_link(ctx, "hypermind-code-blocks")
|
|
85
89
|
format_output(result, ctx.obj["FORMAT"])
|
|
86
90
|
|
|
87
91
|
|
|
@@ -378,17 +382,8 @@ def remove_file(ctx, code_block_id, file_path):
|
|
|
378
382
|
await client.ensure_authenticated()
|
|
379
383
|
|
|
380
384
|
code_block_data = await client.hypermind_code_blocks.get_one(code_block_id_validated)
|
|
381
|
-
file_name =
|
|
382
|
-
|
|
383
|
-
if code_block_data.code_files:
|
|
384
|
-
for file in code_block_data.code_files:
|
|
385
|
-
if (
|
|
386
|
-
file_path.split("/")[-1].split(".")[0].lower()
|
|
387
|
-
== file.split("_")[0].lower()
|
|
388
|
-
):
|
|
389
|
-
file_name = file
|
|
390
|
-
break
|
|
391
|
-
|
|
385
|
+
file_name = match_stored_file(code_block_data.code_files or [], file_path)
|
|
386
|
+
|
|
392
387
|
if not file_name:
|
|
393
388
|
print_message(f"[yellow]File not found: {file_path}[/yellow]", ctx.obj["FORMAT"])
|
|
394
389
|
return None
|
|
@@ -10,6 +10,7 @@ from testzeus_cli.config import get_client_config
|
|
|
10
10
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
11
11
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
12
12
|
from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
|
|
13
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
13
14
|
|
|
14
15
|
console = Console()
|
|
15
16
|
|
|
@@ -24,7 +25,7 @@ def knowledge_bases_group():
|
|
|
24
25
|
@click.option(
|
|
25
26
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
26
27
|
)
|
|
27
|
-
@click.option("--sort", help="Sort by field")
|
|
28
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
28
29
|
@click.option("--expand", help="Expand related entities")
|
|
29
30
|
@click.pass_context
|
|
30
31
|
def list(ctx, filters, sort, expand):
|
|
@@ -51,6 +52,7 @@ def list(ctx, filters, sort, expand):
|
|
|
51
52
|
|
|
52
53
|
try:
|
|
53
54
|
result = asyncio.run(_run())
|
|
55
|
+
print_platform_link(ctx, "integrations/knowledge-base")
|
|
54
56
|
format_output(result, ctx.obj["FORMAT"])
|
|
55
57
|
except Exception as e:
|
|
56
58
|
print_message(f"[red]Error listing knowledge bases: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -81,6 +83,7 @@ def get_kb(ctx, kb_id, expand):
|
|
|
81
83
|
|
|
82
84
|
try:
|
|
83
85
|
result = asyncio.run(_run())
|
|
86
|
+
print_platform_link(ctx, "integrations/knowledge-base")
|
|
84
87
|
format_output(result, ctx.obj["FORMAT"])
|
|
85
88
|
except Exception as e:
|
|
86
89
|
print_message(f"[red]Error getting knowledge base: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -26,7 +26,7 @@ def notification_channels_group():
|
|
|
26
26
|
@click.option(
|
|
27
27
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
28
28
|
)
|
|
29
|
-
@click.option("--sort", help="Sort by field")
|
|
29
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
30
30
|
@click.option("--expand", help="Expand related entities (comma-separated)")
|
|
31
31
|
@click.option("--page", default=1, help="Page number")
|
|
32
32
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -10,6 +10,7 @@ from testzeus_cli.config import get_client_config
|
|
|
10
10
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
11
11
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
12
12
|
from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id, validate_tenant_ownership
|
|
13
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
13
14
|
|
|
14
15
|
console = Console()
|
|
15
16
|
|
|
@@ -59,7 +60,7 @@ def create(ctx, name, value):
|
|
|
59
60
|
@click.option(
|
|
60
61
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
61
62
|
)
|
|
62
|
-
@click.option("--sort", help="Sort by field")
|
|
63
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
63
64
|
@click.option("--expand", help="Expand related entities")
|
|
64
65
|
@click.pass_context
|
|
65
66
|
def list(ctx, filters, sort, expand):
|
|
@@ -86,6 +87,7 @@ def list(ctx, filters, sort, expand):
|
|
|
86
87
|
|
|
87
88
|
try:
|
|
88
89
|
result = asyncio.run(_run())
|
|
90
|
+
print_platform_link(ctx, "tags")
|
|
89
91
|
format_output(result, ctx.obj["FORMAT"])
|
|
90
92
|
except Exception as e:
|
|
91
93
|
print_message(f"[red]Error listing tags: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -116,6 +118,7 @@ def get_tags(ctx, tag_id, expand):
|
|
|
116
118
|
|
|
117
119
|
try:
|
|
118
120
|
result = asyncio.run(_run())
|
|
121
|
+
print_platform_link(ctx, "tags")
|
|
119
122
|
format_output(result, ctx.obj["FORMAT"])
|
|
120
123
|
except Exception as e:
|
|
121
124
|
print_message(f"[red]Error getting tag: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
@@ -14,6 +14,8 @@ from testzeus_cli.config import get_client_config
|
|
|
14
14
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
15
15
|
from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
|
|
16
16
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
17
|
+
from testzeus_cli.utils.files import match_stored_file
|
|
18
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
17
19
|
from pocketbase.client import FileUpload
|
|
18
20
|
|
|
19
21
|
console = Console()
|
|
@@ -59,7 +61,7 @@ def test_data_group():
|
|
|
59
61
|
@click.option(
|
|
60
62
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
61
63
|
)
|
|
62
|
-
@click.option("--sort", help="Sort by field")
|
|
64
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
63
65
|
@click.option("--expand", help="Expand related entities")
|
|
64
66
|
@click.pass_context
|
|
65
67
|
def list_test_data(ctx, filters, sort, expand):
|
|
@@ -85,6 +87,7 @@ def list_test_data(ctx, filters, sort, expand):
|
|
|
85
87
|
return test_data
|
|
86
88
|
|
|
87
89
|
result = asyncio.run(_run())
|
|
90
|
+
print_platform_link(ctx, "test-data")
|
|
88
91
|
format_output(result, ctx.obj["FORMAT"])
|
|
89
92
|
|
|
90
93
|
|
|
@@ -114,6 +117,7 @@ def get_test_data(ctx, test_data_id, expand):
|
|
|
114
117
|
return test_data.data
|
|
115
118
|
|
|
116
119
|
result = asyncio.run(_run())
|
|
120
|
+
print_platform_link(ctx, "test-data")
|
|
117
121
|
format_output(result, ctx.obj["FORMAT"])
|
|
118
122
|
|
|
119
123
|
|
|
@@ -443,15 +447,9 @@ def remove_file(ctx, test_data_id, file_path):
|
|
|
443
447
|
test_data_data = await client.test_data.get_one(test_data_id)
|
|
444
448
|
validate_tenant_ownership(test_data_data.data, tenant_id, "test data")
|
|
445
449
|
|
|
446
|
-
file_name =
|
|
447
|
-
if
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
file_path.split("/")[-1].split(".")[0].lower()
|
|
451
|
-
== file.split("_")[0].lower()
|
|
452
|
-
):
|
|
453
|
-
file_name = file
|
|
454
|
-
break
|
|
450
|
+
file_name = match_stored_file(test_data_data.supporting_data_files or [], file_path)
|
|
451
|
+
if not file_name:
|
|
452
|
+
raise ValueError(f"File not found in test data: {file_path}")
|
|
455
453
|
params = {
|
|
456
454
|
"supporting_data_files-": [file_name],
|
|
457
455
|
"tenant": tenant_id,
|
|
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
|
|
|
12
12
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
13
13
|
from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
|
|
14
14
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
15
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
15
16
|
|
|
16
17
|
console = Console()
|
|
17
18
|
|
|
@@ -26,7 +27,7 @@ def test_report_schedules_group():
|
|
|
26
27
|
@click.option(
|
|
27
28
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
28
29
|
)
|
|
29
|
-
@click.option("--sort", help="Sort by field")
|
|
30
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
30
31
|
@click.option("--expand", help="Expand related entities (comma-separated)")
|
|
31
32
|
@click.option("--page", default=1, help="Page number")
|
|
32
33
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -54,6 +55,7 @@ def list_schedules(ctx, filters, sort, expand, page, per_page):
|
|
|
54
55
|
return schedules
|
|
55
56
|
|
|
56
57
|
result = asyncio.run(_run())
|
|
58
|
+
print_platform_link(ctx, "report-scheduler")
|
|
57
59
|
format_output(result, ctx.obj["FORMAT"])
|
|
58
60
|
|
|
59
61
|
|
|
@@ -84,6 +86,7 @@ def get_schedule(ctx, schedule_id, expand):
|
|
|
84
86
|
return schedule.data
|
|
85
87
|
|
|
86
88
|
result = asyncio.run(_run())
|
|
89
|
+
print_platform_link(ctx, "report-scheduler")
|
|
87
90
|
format_output(result, ctx.obj["FORMAT"])
|
|
88
91
|
|
|
89
92
|
|
|
@@ -13,6 +13,7 @@ from testzeus_cli.config import get_client_config
|
|
|
13
13
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
14
14
|
from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
|
|
15
15
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
16
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
16
17
|
|
|
17
18
|
console = Console()
|
|
18
19
|
|
|
@@ -27,7 +28,7 @@ def test_run_groups_group():
|
|
|
27
28
|
@click.option(
|
|
28
29
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
29
30
|
)
|
|
30
|
-
@click.option("--sort", help="Sort by field")
|
|
31
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
31
32
|
@click.option("--expand", help="Expand related entities (comma-separated)")
|
|
32
33
|
@click.option("--page", default=1, help="Page number")
|
|
33
34
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -248,7 +249,7 @@ def cancel_test_run_group(ctx, test_run_group_id):
|
|
|
248
249
|
|
|
249
250
|
async with client:
|
|
250
251
|
if token:
|
|
251
|
-
initialize_client_with_token(client, token)
|
|
252
|
+
initialize_client_with_token(client, token, stored_tenant_id)
|
|
252
253
|
else:
|
|
253
254
|
await client.ensure_authenticated()
|
|
254
255
|
|
|
@@ -261,10 +262,8 @@ def cancel_test_run_group(ctx, test_run_group_id):
|
|
|
261
262
|
f"[blue]Cancelling test run group: {test_run_group_id_validated}[/blue]"
|
|
262
263
|
)
|
|
263
264
|
|
|
264
|
-
result = await client.test_run_groups.
|
|
265
|
-
test_run_group_id_validated
|
|
266
|
-
tenant=stored_tenant_id,
|
|
267
|
-
modified_by=stored_user_id,
|
|
265
|
+
result = await client.test_run_groups.cancel_group(
|
|
266
|
+
test_run_group_id_validated
|
|
268
267
|
)
|
|
269
268
|
return result.data if hasattr(result, "data") else result
|
|
270
269
|
|
|
@@ -379,6 +378,7 @@ def download_test_run_group_report(ctx, test_run_group_id, output_dir, report_fo
|
|
|
379
378
|
|
|
380
379
|
try:
|
|
381
380
|
result = asyncio.run(_run())
|
|
381
|
+
print_platform_link(ctx, "reports")
|
|
382
382
|
if result["success"]:
|
|
383
383
|
print_message(
|
|
384
384
|
f"[green]Report downloaded successfully to: {result['file_path']}[/green]",
|
|
@@ -9,13 +9,21 @@ from pathlib import Path
|
|
|
9
9
|
import click
|
|
10
10
|
from rich.console import Console
|
|
11
11
|
from rich.progress import Progress
|
|
12
|
+
from rich.table import Table
|
|
12
13
|
from datetime import datetime
|
|
13
14
|
|
|
14
15
|
from testzeus_sdk import TestZeusClient
|
|
15
16
|
from testzeus_cli.config import get_client_config
|
|
16
|
-
from testzeus_cli.utils.formatters import
|
|
17
|
+
from testzeus_cli.utils.formatters import (
|
|
18
|
+
format_dict_as_table,
|
|
19
|
+
format_list_as_table,
|
|
20
|
+
format_output,
|
|
21
|
+
format_value_for_display,
|
|
22
|
+
print_message,
|
|
23
|
+
)
|
|
17
24
|
from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
|
|
18
25
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
26
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
19
27
|
|
|
20
28
|
console = Console()
|
|
21
29
|
logger = logging.getLogger("testzeus_cli.commands.test_runs")
|
|
@@ -35,7 +43,7 @@ def test_runs_group():
|
|
|
35
43
|
@click.option(
|
|
36
44
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
37
45
|
)
|
|
38
|
-
@click.option("--sort", help="Sort by field")
|
|
46
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
39
47
|
@click.option("--expand", help="Expand related entities")
|
|
40
48
|
@click.option("--page", default=1, type=int, show_default=True, help="Page number")
|
|
41
49
|
@click.option("--per-page", default=100, type=int, show_default=True, help="Items per page")
|
|
@@ -74,7 +82,12 @@ def list_test_runs(ctx, filters, sort, expand, page, per_page):
|
|
|
74
82
|
return test_runs
|
|
75
83
|
|
|
76
84
|
result = asyncio.run(_run())
|
|
77
|
-
|
|
85
|
+
print_platform_link(ctx, "test-runs")
|
|
86
|
+
format_output(
|
|
87
|
+
result,
|
|
88
|
+
ctx.obj["FORMAT"],
|
|
89
|
+
columns=["id", "name", "status", "created", "updated", "test_status"],
|
|
90
|
+
)
|
|
78
91
|
|
|
79
92
|
|
|
80
93
|
@test_runs_group.command(name="get")
|
|
@@ -105,9 +118,79 @@ def get_test_run(ctx, test_run_id, expand):
|
|
|
105
118
|
return test_run.data
|
|
106
119
|
|
|
107
120
|
result = asyncio.run(_run())
|
|
121
|
+
print_platform_link(ctx, f"test-runs/{test_run_id}")
|
|
108
122
|
format_output(result, ctx.obj["FORMAT"])
|
|
109
123
|
|
|
110
124
|
|
|
125
|
+
_EXPANDED_RUN_FIELDS = [
|
|
126
|
+
"id", "name", "status", "test_status", "executor", "testing_type",
|
|
127
|
+
"execution_mode", "ctrf_status", "is_live_trigger", "test",
|
|
128
|
+
"test_feature", "test_data", "test_params", "tags", "environment",
|
|
129
|
+
"hypermind_code_blocks", "outputs", "test_run_group", "test_suite_run",
|
|
130
|
+
"start_time", "end_time", "created", "updated",
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
_EXPANDED_DASH_FIELDS = [
|
|
134
|
+
"id", "status", "test_status", "executor", "ctrf_status", "token_usage",
|
|
135
|
+
"heal_recommended", "sdet_failure_reason",
|
|
136
|
+
"start_time", "end_time",
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _render_expanded_test_run(expanded: dict) -> None:
|
|
141
|
+
"""Render the expanded test run tree as sectioned tables."""
|
|
142
|
+
|
|
143
|
+
def important(record, fields):
|
|
144
|
+
return {k: record.get(k) for k in fields if record.get(k) not in (None, "", [], {})}
|
|
145
|
+
|
|
146
|
+
run = expanded.get("test_run") or {}
|
|
147
|
+
console.print("\n[bold cyan]Test Run[/bold cyan]")
|
|
148
|
+
format_dict_as_table({k: run.get(k) for k in _EXPANDED_RUN_FIELDS})
|
|
149
|
+
|
|
150
|
+
for dash in expanded.get("test_run_dashs") or []:
|
|
151
|
+
console.print("\n[bold cyan]Execution[/bold cyan]")
|
|
152
|
+
format_dict_as_table(important(dash, _EXPANDED_DASH_FIELDS))
|
|
153
|
+
|
|
154
|
+
outputs = expanded.get("test_run_dash_outputs") or []
|
|
155
|
+
for index, output in enumerate(outputs, start=1):
|
|
156
|
+
console.print(f"\n[bold cyan]Output {index}/{len(outputs)}[/bold cyan]")
|
|
157
|
+
format_dict_as_table(
|
|
158
|
+
{k: output.get(k) for k in ("id", "name", "status", "execution_plan", "created", "updated")}
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
steps = sorted(expanded.get("test_run_dash_output_steps") or [], key=lambda s: s.get("created") or "")
|
|
162
|
+
if steps:
|
|
163
|
+
console.print(f"\n[bold cyan]Steps ({len(steps)})[/bold cyan]")
|
|
164
|
+
steps_table = Table(show_lines=True)
|
|
165
|
+
steps_table.add_column("ID", min_width=15, no_wrap=True)
|
|
166
|
+
steps_table.add_column("Name", max_width=30, overflow="fold")
|
|
167
|
+
steps_table.add_column("Status", max_width=10, justify="center")
|
|
168
|
+
steps_table.add_column("Helper", max_width=8)
|
|
169
|
+
steps_table.add_column("Assert", max_width=6, justify="center")
|
|
170
|
+
steps_table.add_column("Passed", max_width=6, justify="center")
|
|
171
|
+
steps_table.add_column("Assert Summary", overflow="fold")
|
|
172
|
+
steps_table.add_column("Step Result", overflow="fold")
|
|
173
|
+
steps_table.add_column("Final Response", overflow="fold")
|
|
174
|
+
for step in steps:
|
|
175
|
+
steps_table.add_row(
|
|
176
|
+
str(step.get("id") or ""),
|
|
177
|
+
str(step.get("name") or ""),
|
|
178
|
+
str(step.get("status") or ""),
|
|
179
|
+
str(step.get("execution_helper") or ""),
|
|
180
|
+
str(step.get("is_assert", "")),
|
|
181
|
+
str(step.get("is_passed", "")),
|
|
182
|
+
format_value_for_display(step.get("assert_summary") or ""),
|
|
183
|
+
format_value_for_display(step.get("step_result") or ""),
|
|
184
|
+
format_value_for_display(step.get("final_response") or ""),
|
|
185
|
+
)
|
|
186
|
+
console.print(steps_table)
|
|
187
|
+
|
|
188
|
+
attachments = expanded.get("test_run_dash_outputs_attachments") or []
|
|
189
|
+
if attachments:
|
|
190
|
+
console.print(f"\n[bold cyan]Attachments ({len(attachments)})[/bold cyan]")
|
|
191
|
+
format_list_as_table(attachments, columns=["id", "name", "file_type", "created"])
|
|
192
|
+
|
|
193
|
+
|
|
111
194
|
@test_runs_group.command(name="get-expanded")
|
|
112
195
|
@click.argument("test_run_id")
|
|
113
196
|
@click.pass_context
|
|
@@ -135,7 +218,11 @@ def get_expanded_test_run(ctx, test_run_id):
|
|
|
135
218
|
return expanded_test_run
|
|
136
219
|
|
|
137
220
|
result = asyncio.run(_run())
|
|
138
|
-
|
|
221
|
+
print_platform_link(ctx, f"test-runs/{test_run_id}")
|
|
222
|
+
if ctx.obj["FORMAT"] == "table" and isinstance(result, dict) and "test_run" in result:
|
|
223
|
+
_render_expanded_test_run(result)
|
|
224
|
+
else:
|
|
225
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
139
226
|
|
|
140
227
|
|
|
141
228
|
@test_runs_group.command(name="watch")
|
|
@@ -206,6 +293,51 @@ def watch_test_run(ctx, test_run_id, interval):
|
|
|
206
293
|
exit(1)
|
|
207
294
|
|
|
208
295
|
|
|
296
|
+
@test_runs_group.command(name="download-attachment")
|
|
297
|
+
@click.argument("attachment_id")
|
|
298
|
+
@click.option(
|
|
299
|
+
"--output-dir", default=".", show_default=True, help="Directory to save the attachment"
|
|
300
|
+
)
|
|
301
|
+
@click.pass_context
|
|
302
|
+
def download_attachment(ctx, attachment_id, output_dir):
|
|
303
|
+
"""Download a specific attachment by its ID (see get-expanded for IDs)"""
|
|
304
|
+
|
|
305
|
+
async def _run():
|
|
306
|
+
config, token, _, _ = get_client_config(
|
|
307
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
308
|
+
)
|
|
309
|
+
client = TestZeusClient(**config)
|
|
310
|
+
|
|
311
|
+
attachment_id_validated = validate_id(attachment_id, "attachment")
|
|
312
|
+
|
|
313
|
+
output_path = Path(output_dir)
|
|
314
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
315
|
+
|
|
316
|
+
async with client:
|
|
317
|
+
if token:
|
|
318
|
+
initialize_client_with_token(client, token)
|
|
319
|
+
else:
|
|
320
|
+
await client.ensure_authenticated()
|
|
321
|
+
|
|
322
|
+
return await client.test_run_dash_outputs_attachments.download_attachment(
|
|
323
|
+
attachment_id_validated, str(output_path)
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
try:
|
|
327
|
+
result = asyncio.run(_run())
|
|
328
|
+
|
|
329
|
+
if not result:
|
|
330
|
+
print_message(
|
|
331
|
+
f"[yellow]No file found for attachment {attachment_id}[/yellow]", ctx.obj["FORMAT"]
|
|
332
|
+
)
|
|
333
|
+
exit(1)
|
|
334
|
+
|
|
335
|
+
print_message(f"[green]Downloaded attachment to {result}[/green]", ctx.obj["FORMAT"])
|
|
336
|
+
except Exception as e:
|
|
337
|
+
print_message(f"[red]Failed to download attachment:[/red] {str(e)}", ctx.obj["FORMAT"])
|
|
338
|
+
exit(1)
|
|
339
|
+
|
|
340
|
+
|
|
209
341
|
@test_runs_group.command(name="download-attachments")
|
|
210
342
|
@click.argument("test_run_id")
|
|
211
343
|
@click.option(
|
|
@@ -234,11 +366,27 @@ def download_attachments(ctx, test_run_id, output_dir):
|
|
|
234
366
|
else:
|
|
235
367
|
await client.ensure_authenticated()
|
|
236
368
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
369
|
+
try:
|
|
370
|
+
# Download all attachments for the test run using positional parameters
|
|
371
|
+
result = await client.test_runs.download_all_attachments(
|
|
372
|
+
test_run_id_validated, str(output_path)
|
|
373
|
+
)
|
|
374
|
+
return result
|
|
375
|
+
except Exception:
|
|
376
|
+
# A common mix-up: passing an attachment ID to this command.
|
|
377
|
+
# If the ID resolves to an attachment, point at the right command.
|
|
378
|
+
try:
|
|
379
|
+
attachment = await client.test_run_dash_outputs_attachments.get_one(
|
|
380
|
+
test_run_id_validated
|
|
381
|
+
)
|
|
382
|
+
except Exception:
|
|
383
|
+
attachment = None
|
|
384
|
+
if attachment:
|
|
385
|
+
raise click.UsageError(
|
|
386
|
+
f"'{test_run_id}' is an attachment ID, not a test run ID. "
|
|
387
|
+
f"Use: testzeus test-runs download-attachment {test_run_id}"
|
|
388
|
+
)
|
|
389
|
+
raise
|
|
242
390
|
|
|
243
391
|
try:
|
|
244
392
|
result = asyncio.run(_run())
|
|
@@ -254,6 +402,8 @@ def download_attachments(ctx, test_run_id, output_dir):
|
|
|
254
402
|
)
|
|
255
403
|
for attachment in result:
|
|
256
404
|
print_message(f"- {attachment}", ctx.obj["FORMAT"])
|
|
405
|
+
except click.UsageError:
|
|
406
|
+
raise
|
|
257
407
|
except Exception as e:
|
|
258
408
|
if ctx.obj.get("VERBOSE"):
|
|
259
409
|
print_message("[red]Failed to download attachments:[/red]", ctx.obj["FORMAT"])
|
|
@@ -21,7 +21,7 @@ def test_suite_node_runs_group():
|
|
|
21
21
|
|
|
22
22
|
@test_suite_node_runs_group.command(name="list")
|
|
23
23
|
@click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
|
|
24
|
-
@click.option("--sort", help="Sort by field")
|
|
24
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
25
25
|
@click.option("--expand", help="Expand related entities")
|
|
26
26
|
@click.option("--page", default=1, help="Page number")
|
|
27
27
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
|
|
|
12
12
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
13
13
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
14
14
|
from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
|
|
15
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def _parse_json_value(raw_value: str, option_name: str):
|
|
@@ -29,7 +30,7 @@ def test_suite_runs_group():
|
|
|
29
30
|
|
|
30
31
|
@test_suite_runs_group.command(name="list")
|
|
31
32
|
@click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
|
|
32
|
-
@click.option("--sort", help="Sort by field")
|
|
33
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
33
34
|
@click.option("--expand", help="Expand related entities")
|
|
34
35
|
@click.option("--page", default=1, help="Page number")
|
|
35
36
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -52,6 +53,7 @@ def list_test_suite_runs(ctx, filters, sort, expand, page, per_page):
|
|
|
52
53
|
expand=expand, sort=sort, filters=filter_dict, page=page, per_page=per_page
|
|
53
54
|
)
|
|
54
55
|
|
|
56
|
+
print_platform_link(ctx, "test-suite-runs")
|
|
55
57
|
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
56
58
|
|
|
57
59
|
|
|
@@ -76,6 +78,7 @@ def get_test_suite_run(ctx, suite_run_id, expand):
|
|
|
76
78
|
run = await client.test_suite_runs.get_one(suite_run_id_validated, expand=expand)
|
|
77
79
|
return run.data
|
|
78
80
|
|
|
81
|
+
print_platform_link(ctx, "test-suite-runs")
|
|
79
82
|
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
80
83
|
|
|
81
84
|
|
|
@@ -29,7 +29,7 @@ def test_suite_schedules_group():
|
|
|
29
29
|
|
|
30
30
|
@test_suite_schedules_group.command(name="list")
|
|
31
31
|
@click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
|
|
32
|
-
@click.option("--sort", help="Sort by field")
|
|
32
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
33
33
|
@click.option("--expand", help="Expand related entities")
|
|
34
34
|
@click.option("--page", default=1, help="Page number")
|
|
35
35
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -159,10 +159,10 @@ def update_test_suite_schedule(
|
|
|
159
159
|
input_values_value = _parse_json_value(input_values, "--input-values") if input_values else None
|
|
160
160
|
|
|
161
161
|
async def _run():
|
|
162
|
-
config, token,
|
|
162
|
+
config, token, tenant_id, user_id = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
|
|
163
163
|
client = TestZeusClient(**config)
|
|
164
164
|
schedule_id_validated = validate_id(schedule_id, "test suite schedule")
|
|
165
|
-
payload = {}
|
|
165
|
+
payload = {"tenant": tenant_id, "modified_by": user_id}
|
|
166
166
|
if name is not None:
|
|
167
167
|
payload["name"] = name
|
|
168
168
|
if test_suite is not None:
|
|
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
|
|
|
12
12
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
13
13
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
14
14
|
from testzeus_cli.utils.validators import parse_key_value_pairs, validate_id
|
|
15
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def _parse_json_value(raw_value: str, option_name: str):
|
|
@@ -29,7 +30,7 @@ def test_suites_group():
|
|
|
29
30
|
|
|
30
31
|
@test_suites_group.command(name="list")
|
|
31
32
|
@click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
|
|
32
|
-
@click.option("--sort", help="Sort by field")
|
|
33
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
33
34
|
@click.option("--expand", help="Expand related entities")
|
|
34
35
|
@click.option("--page", default=1, help="Page number")
|
|
35
36
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -56,7 +57,12 @@ def list_test_suites(ctx, filters, sort, expand, page, per_page):
|
|
|
56
57
|
per_page=per_page,
|
|
57
58
|
)
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
print_platform_link(ctx, "test-suites")
|
|
61
|
+
format_output(
|
|
62
|
+
asyncio.run(_run()),
|
|
63
|
+
ctx.obj["FORMAT"],
|
|
64
|
+
columns=["id", "name", "status", "created", "updated", "tests"],
|
|
65
|
+
)
|
|
60
66
|
|
|
61
67
|
|
|
62
68
|
@test_suites_group.command(name="get")
|
|
@@ -80,6 +86,7 @@ def get_test_suite(ctx, suite_id, expand):
|
|
|
80
86
|
suite = await client.test_suites.get_one(suite_id_validated, expand=expand)
|
|
81
87
|
return suite.data
|
|
82
88
|
|
|
89
|
+
print_platform_link(ctx, "test-suites")
|
|
83
90
|
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
84
91
|
|
|
85
92
|
|
|
@@ -184,10 +191,10 @@ def update_test_suite(
|
|
|
184
191
|
input_schema_value = _parse_json_value(input_schema, "--input-schema") if input_schema else None
|
|
185
192
|
|
|
186
193
|
async def _run():
|
|
187
|
-
config, token,
|
|
194
|
+
config, token, tenant_id, user_id = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
|
|
188
195
|
client = TestZeusClient(**config)
|
|
189
196
|
suite_id_validated = validate_id(suite_id, "test suite")
|
|
190
|
-
payload = {}
|
|
197
|
+
payload = {"tenant": tenant_id, "modified_by": user_id}
|
|
191
198
|
if name is not None:
|
|
192
199
|
payload["name"] = name
|
|
193
200
|
if workflow_definition_value is not None:
|
|
@@ -14,6 +14,7 @@ from testzeus_cli.utils.formatters import format_output, print_message
|
|
|
14
14
|
from testzeus_cli.utils.validators import validate_id, validate_tenant_ownership, parse_key_value_pairs
|
|
15
15
|
from testzeus_cli.utils.client import run_client_operation
|
|
16
16
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
17
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
17
18
|
|
|
18
19
|
console = Console()
|
|
19
20
|
|
|
@@ -28,7 +29,7 @@ def tests_group():
|
|
|
28
29
|
@click.option(
|
|
29
30
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
30
31
|
)
|
|
31
|
-
@click.option("--sort", help="Sort by field")
|
|
32
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
32
33
|
@click.option("--expand", help="Expand related entities")
|
|
33
34
|
@click.pass_context
|
|
34
35
|
def list_tests(ctx, filters, sort, expand):
|
|
@@ -42,7 +43,12 @@ def list_tests(ctx, filters, sort, expand):
|
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
result = run_client_operation(ctx, _list_tests)
|
|
45
|
-
|
|
46
|
+
print_platform_link(ctx, "tests")
|
|
47
|
+
format_output(
|
|
48
|
+
result,
|
|
49
|
+
ctx.obj["FORMAT"],
|
|
50
|
+
columns=["id", "name", "created", "updated", "modified_by", "environment", "test_data"],
|
|
51
|
+
)
|
|
46
52
|
|
|
47
53
|
|
|
48
54
|
@tests_group.command(name="get")
|
|
@@ -71,6 +77,7 @@ def get_test(ctx, test_id, expand):
|
|
|
71
77
|
return test.data
|
|
72
78
|
|
|
73
79
|
result = asyncio.run(_run())
|
|
80
|
+
print_platform_link(ctx, "tests")
|
|
74
81
|
format_output(result, ctx.obj["FORMAT"])
|
|
75
82
|
|
|
76
83
|
|
|
@@ -27,7 +27,7 @@ def tests_ai_generator_group():
|
|
|
27
27
|
@click.option(
|
|
28
28
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
29
29
|
)
|
|
30
|
-
@click.option("--sort", help="Sort by field")
|
|
30
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
31
31
|
@click.option("--expand", help="Expand related entities (comma-separated)")
|
|
32
32
|
@click.option("--page", default=1, help="Page number")
|
|
33
33
|
@click.option("--per-page", default=50, help="Items per page")
|
|
@@ -12,6 +12,7 @@ from testzeus_cli.config import get_client_config
|
|
|
12
12
|
from testzeus_cli.utils.formatters import format_output, print_message
|
|
13
13
|
from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
|
|
14
14
|
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
15
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
15
16
|
|
|
16
17
|
console = Console()
|
|
17
18
|
|
|
@@ -26,7 +27,7 @@ def user_integrations_group():
|
|
|
26
27
|
@click.option(
|
|
27
28
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
28
29
|
)
|
|
29
|
-
@click.option("--sort", help="Sort by field")
|
|
30
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
30
31
|
@click.option("--expand", help="Expand related entities")
|
|
31
32
|
@click.pass_context
|
|
32
33
|
def list_user_integrations(ctx, filters, sort, expand):
|
|
@@ -52,6 +53,7 @@ def list_user_integrations(ctx, filters, sort, expand):
|
|
|
52
53
|
return integrations
|
|
53
54
|
|
|
54
55
|
result = asyncio.run(_run())
|
|
56
|
+
print_platform_link(ctx, "integrations/connections")
|
|
55
57
|
format_output(result, ctx.obj["FORMAT"])
|
|
56
58
|
|
|
57
59
|
|
|
@@ -81,6 +83,7 @@ def get_user_integration(ctx, integration_id, expand):
|
|
|
81
83
|
return integration.data
|
|
82
84
|
|
|
83
85
|
result = asyncio.run(_run())
|
|
86
|
+
print_platform_link(ctx, "integrations/connections")
|
|
84
87
|
format_output(result, ctx.obj["FORMAT"])
|
|
85
88
|
|
|
86
89
|
|
|
@@ -88,7 +91,7 @@ def get_user_integration(ctx, integration_id, expand):
|
|
|
88
91
|
@click.option(
|
|
89
92
|
"--filters", "-f", multiple=True, help="Filter results (format: key=value)"
|
|
90
93
|
)
|
|
91
|
-
@click.option("--sort", help="Sort by field")
|
|
94
|
+
@click.option("--sort", default="-updated", show_default=True, help="Sort by field")
|
|
92
95
|
@click.option("--expand", help="Expand related entities")
|
|
93
96
|
@click.pass_context
|
|
94
97
|
def get_first_user_integration(ctx, filters, sort, expand):
|
|
@@ -108,10 +111,12 @@ def get_first_user_integration(ctx, filters, sort, expand):
|
|
|
108
111
|
if token:
|
|
109
112
|
initialize_client_with_token(client, token)
|
|
110
113
|
|
|
111
|
-
|
|
112
|
-
expand=expand, sort=sort, filters=filter_dict
|
|
114
|
+
result = await client.user_integrations.get_list(
|
|
115
|
+
expand=expand, sort=sort, filters=filter_dict, per_page=1
|
|
113
116
|
)
|
|
114
|
-
|
|
117
|
+
items = result.get("items", [])
|
|
118
|
+
integration = items[0] if items else None
|
|
119
|
+
|
|
115
120
|
if integration:
|
|
116
121
|
return integration.data
|
|
117
122
|
else:
|
|
@@ -121,6 +126,7 @@ def get_first_user_integration(ctx, filters, sort, expand):
|
|
|
121
126
|
try:
|
|
122
127
|
result = asyncio.run(_run())
|
|
123
128
|
if result:
|
|
129
|
+
print_platform_link(ctx, "integrations/connections")
|
|
124
130
|
format_output(result, ctx.obj["FORMAT"])
|
|
125
131
|
except Exception as e:
|
|
126
132
|
print_message(f"[red]Error getting user integration:[/red] {str(e)}", ctx.obj["FORMAT"])
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
File-related utilities for TestZeus CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def match_stored_file(stored_files: List[str], file_path: str) -> Optional[str]:
|
|
10
|
+
"""
|
|
11
|
+
Find the stored PocketBase filename matching a user-supplied file path.
|
|
12
|
+
|
|
13
|
+
PocketBase stores uploads as ``<snakecase(basename)>_<random10>.<ext>``,
|
|
14
|
+
so both the exact stored name and the original local filename are accepted.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
stored_files: Stored filenames from the record's file field
|
|
18
|
+
file_path: User-supplied path or filename (local name or stored name)
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
The matching stored filename, or None if nothing matches
|
|
22
|
+
"""
|
|
23
|
+
requested = file_path.replace("\\", "/").split("/")[-1]
|
|
24
|
+
if not requested:
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
for stored in stored_files:
|
|
28
|
+
if stored == requested:
|
|
29
|
+
return stored
|
|
30
|
+
|
|
31
|
+
base, dot, ext = requested.rpartition(".")
|
|
32
|
+
if not dot:
|
|
33
|
+
base, ext = requested, ""
|
|
34
|
+
normalized = re.sub(r"[^a-z0-9]+", "_", base.lower()).strip("_")
|
|
35
|
+
|
|
36
|
+
for stored in stored_files:
|
|
37
|
+
stored_base, stored_dot, stored_ext = stored.rpartition(".")
|
|
38
|
+
if not stored_dot:
|
|
39
|
+
stored_base, stored_ext = stored, ""
|
|
40
|
+
if ext and stored_ext.lower() != ext.lower():
|
|
41
|
+
continue
|
|
42
|
+
if stored_base.lower().rsplit("_", 1)[0] == normalized:
|
|
43
|
+
return stored
|
|
44
|
+
|
|
45
|
+
return None
|
|
@@ -20,13 +20,15 @@ EXCLUDED_FIELDS = {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def format_output(data: Any, format_type: str = "table") -> None:
|
|
23
|
+
def format_output(data: Any, format_type: str = "table", columns: Optional[List[str]] = None) -> None:
|
|
24
24
|
"""
|
|
25
25
|
Format and print output based on the specified format type
|
|
26
26
|
|
|
27
27
|
Args:
|
|
28
28
|
data: Data to format (dict, list, or primitive)
|
|
29
29
|
format_type: Output format type ("table", "json", or "yaml")
|
|
30
|
+
columns: Optional explicit column keys (and order) for table output;
|
|
31
|
+
ignored for json/yaml, which always carry the full payload
|
|
30
32
|
"""
|
|
31
33
|
if format_type == "json":
|
|
32
34
|
# Use regular print() for JSON to avoid Rich console formatting that can corrupt JSON
|
|
@@ -35,9 +37,9 @@ def format_output(data: Any, format_type: str = "table") -> None:
|
|
|
35
37
|
console.print(yaml.dump(data, sort_keys=False, default_flow_style=False))
|
|
36
38
|
else: # table format
|
|
37
39
|
if isinstance(data, dict):
|
|
38
|
-
format_dict_as_table(data)
|
|
40
|
+
format_dict_as_table(data, columns=columns)
|
|
39
41
|
elif isinstance(data, list):
|
|
40
|
-
format_list_as_table(data)
|
|
42
|
+
format_list_as_table(data, columns=columns)
|
|
41
43
|
else:
|
|
42
44
|
# Simple value, just print it
|
|
43
45
|
console.print(str(data))
|
|
@@ -150,13 +152,14 @@ def format_value_for_display(value: Any) -> str:
|
|
|
150
152
|
return str(value)
|
|
151
153
|
|
|
152
154
|
|
|
153
|
-
def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> None:
|
|
155
|
+
def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None, columns: Optional[List[str]] = None) -> None:
|
|
154
156
|
"""
|
|
155
157
|
Format a dictionary as a table
|
|
156
158
|
|
|
157
159
|
Args:
|
|
158
160
|
data: Dictionary to format
|
|
159
161
|
title: Optional table title
|
|
162
|
+
columns: Optional explicit column keys for list rendering
|
|
160
163
|
"""
|
|
161
164
|
# Special handling for paginated responses
|
|
162
165
|
if "items" in data and isinstance(data["items"], list):
|
|
@@ -168,7 +171,7 @@ def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> N
|
|
|
168
171
|
)
|
|
169
172
|
|
|
170
173
|
# Format the items
|
|
171
|
-
format_list_as_table(data["items"], title)
|
|
174
|
+
format_list_as_table(data["items"], title, columns=columns)
|
|
172
175
|
return
|
|
173
176
|
|
|
174
177
|
# Standard dictionary rendering
|
|
@@ -190,13 +193,15 @@ def format_dict_as_table(data: Dict[str, Any], title: Optional[str] = None) -> N
|
|
|
190
193
|
console.print(table)
|
|
191
194
|
|
|
192
195
|
|
|
193
|
-
def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
|
|
196
|
+
def format_list_as_table(data: List[Any], title: Optional[str] = None, columns: Optional[List[str]] = None) -> None:
|
|
194
197
|
"""
|
|
195
198
|
Format a list as a table
|
|
196
199
|
|
|
197
200
|
Args:
|
|
198
201
|
data: List to format
|
|
199
202
|
title: Optional table title
|
|
203
|
+
columns: Optional explicit column keys (and order); overrides the
|
|
204
|
+
automatic priority-based column selection
|
|
200
205
|
"""
|
|
201
206
|
if not data:
|
|
202
207
|
console.print("[yellow]No data available[/yellow]")
|
|
@@ -222,50 +227,55 @@ def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
|
|
|
222
227
|
# Create table with columns for each key
|
|
223
228
|
table = Table(title=title, show_lines=True)
|
|
224
229
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
230
|
+
if columns:
|
|
231
|
+
# Explicit column list from the caller: keep the given order,
|
|
232
|
+
# drop keys absent from every record
|
|
233
|
+
columns = [key for key in columns if key in all_keys]
|
|
234
|
+
else:
|
|
235
|
+
# Keep table manageable - use most common/important fields
|
|
236
|
+
# Prioritize certain fields - order determines display order
|
|
237
|
+
priority_fields = [
|
|
238
|
+
"id",
|
|
239
|
+
"name",
|
|
240
|
+
"status",
|
|
241
|
+
"created",
|
|
242
|
+
"updated",
|
|
243
|
+
"start_time",
|
|
244
|
+
"end_time",
|
|
245
|
+
"test", # Add test reference
|
|
246
|
+
"duration", # Add test duration
|
|
247
|
+
"tenant", # Add tenant reference
|
|
248
|
+
]
|
|
249
|
+
|
|
250
|
+
# Limit max columns to make output more readable
|
|
251
|
+
max_display_columns = 6 # Reduce from 10 to 6 for better readability
|
|
252
|
+
|
|
253
|
+
# First ensure we have id and name if they exist
|
|
254
|
+
filtered_keys = set()
|
|
255
|
+
for key in ["id", "name"]:
|
|
256
|
+
if key in all_keys:
|
|
257
|
+
filtered_keys.add(key)
|
|
258
|
+
|
|
259
|
+
# Then add other priority fields until we reach the limit
|
|
260
|
+
for key in priority_fields:
|
|
261
|
+
if (
|
|
262
|
+
key in all_keys
|
|
263
|
+
and key not in filtered_keys
|
|
264
|
+
and len(filtered_keys) < max_display_columns
|
|
265
|
+
):
|
|
266
|
+
filtered_keys.add(key)
|
|
267
|
+
|
|
268
|
+
# If we still have room, add some non-priority fields
|
|
269
|
+
if len(filtered_keys) < max_display_columns:
|
|
270
|
+
remaining_keys = sorted(list(all_keys - filtered_keys))
|
|
271
|
+
remaining_keys = remaining_keys[: max_display_columns - len(filtered_keys)]
|
|
272
|
+
filtered_keys.update(remaining_keys)
|
|
273
|
+
|
|
274
|
+
# Sort columns with priority fields first
|
|
275
|
+
columns = sorted(
|
|
276
|
+
filtered_keys,
|
|
277
|
+
key=lambda x: (priority_fields.index(x) if x in priority_fields else 999,),
|
|
278
|
+
)
|
|
269
279
|
|
|
270
280
|
# Add columns to table with appropriate width for IDs
|
|
271
281
|
for key in columns:
|
|
@@ -280,7 +290,7 @@ def format_list_as_table(data: List[Any], title: Optional[str] = None) -> None:
|
|
|
280
290
|
table.add_column("Status", min_width=10, max_width=10, justify="center")
|
|
281
291
|
else:
|
|
282
292
|
# For other columns: standard format
|
|
283
|
-
table.add_column(key.
|
|
293
|
+
table.add_column(key.replace("_", " ").title(), width=20, overflow="ellipsis")
|
|
284
294
|
|
|
285
295
|
# Add rows
|
|
286
296
|
for item in data:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Platform web-app link helpers for TestZeus CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from urllib.parse import urlparse
|
|
6
|
+
|
|
7
|
+
from testzeus_cli.config import get_client_config
|
|
8
|
+
from testzeus_cli.utils.formatters import print_message
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def platform_url(api_base_url: str, path: str) -> str:
|
|
12
|
+
"""
|
|
13
|
+
Build a TestZeus web-app URL from the API base URL.
|
|
14
|
+
|
|
15
|
+
The platform app lives on the API host minus its ``pb.`` prefix
|
|
16
|
+
(e.g. ``pb.dev.testzeus.app`` -> ``dev.testzeus.app``).
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
api_base_url: PocketBase/API base URL from the profile config
|
|
20
|
+
path: App path, e.g. ``test-runs/<id>`` or ``tests``
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Full https URL to the platform page
|
|
24
|
+
"""
|
|
25
|
+
host = urlparse(api_base_url).netloc or api_base_url
|
|
26
|
+
if host.startswith("pb."):
|
|
27
|
+
host = host[3:]
|
|
28
|
+
return f"https://{host}/{path.lstrip('/')}"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def print_platform_link(ctx, path: str) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Print a link to the matching platform page above command output.
|
|
34
|
+
|
|
35
|
+
Silent on json format (via print_message) and on any config error,
|
|
36
|
+
so it never breaks the command itself.
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
config, _, _, _ = get_client_config(
|
|
40
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
41
|
+
)
|
|
42
|
+
base_url = config.get("base_url", "")
|
|
43
|
+
if base_url:
|
|
44
|
+
print_message(
|
|
45
|
+
f"[blue]Platform:[/blue] {platform_url(base_url, path)}",
|
|
46
|
+
ctx.obj["FORMAT"],
|
|
47
|
+
)
|
|
48
|
+
except Exception:
|
|
49
|
+
pass
|
|
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
|