testzeus-cli 0.0.4__tar.gz → 0.0.5__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.4 → testzeus_cli-0.0.5}/PKG-INFO +2 -2
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/pyproject.toml +2 -2
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/cli.py +4 -0
- testzeus_cli-0.0.5/testzeus_cli/commands/environments.py +116 -0
- testzeus_cli-0.0.5/testzeus_cli/commands/tags.py +103 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/commands/test_runs.py +45 -1
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/utils/formatters.py +1 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/LICENSE +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/README.md +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/__init__.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/auth.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/commands/__init__.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/commands/test_data.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/commands/tests.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/config.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/utils/__init__.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/utils/auth.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/utils/client.py +0 -0
- {testzeus_cli-0.0.4 → testzeus_cli-0.0.5}/testzeus_cli/utils/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testzeus-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Command-line interface for TestZeus testing platform
|
|
5
5
|
Home-page: https://github.com/test-zeus-ai/testzeus-cli
|
|
6
6
|
Author: Shriyansh Agnihotri
|
|
@@ -15,7 +15,7 @@ Requires-Dist: keyring (>=24.0.0,<25.0.0)
|
|
|
15
15
|
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
16
16
|
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
17
17
|
Requires-Dist: rich (>=13.3.1,<14.0.0)
|
|
18
|
-
Requires-Dist: testzeus-sdk (>=0.0.
|
|
18
|
+
Requires-Dist: testzeus-sdk (>=0.0.8,<0.0.9)
|
|
19
19
|
Project-URL: Repository, https://github.com/test-zeus-ai/testzeus-cli
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
@@ -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.5"
|
|
8
8
|
description = "Command-line interface for TestZeus testing platform"
|
|
9
9
|
authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -22,7 +22,7 @@ pydantic = "^2.0.0"
|
|
|
22
22
|
pyyaml = "^6.0"
|
|
23
23
|
keyring = "^24.0.0"
|
|
24
24
|
ipdb = "^0.13.13"
|
|
25
|
-
testzeus-sdk = "^0.0.
|
|
25
|
+
testzeus-sdk = "^0.0.8"
|
|
26
26
|
|
|
27
27
|
[tool.poetry.group.dev.dependencies]
|
|
28
28
|
pytest = "^7.3.1"
|
|
@@ -12,6 +12,8 @@ from testzeus_cli.auth import login_command, logout_command, whoami_command
|
|
|
12
12
|
from testzeus_cli.commands.tests import tests_group
|
|
13
13
|
from testzeus_cli.commands.test_runs import test_runs_group
|
|
14
14
|
from testzeus_cli.commands.test_data import test_data_group
|
|
15
|
+
from testzeus_cli.commands.tags import tags_group
|
|
16
|
+
from testzeus_cli.commands.environments import environments_group
|
|
15
17
|
|
|
16
18
|
# New command groups can be imported here when implemented
|
|
17
19
|
|
|
@@ -47,6 +49,8 @@ cli.add_command(whoami_command)
|
|
|
47
49
|
cli.add_command(tests_group)
|
|
48
50
|
cli.add_command(test_runs_group)
|
|
49
51
|
cli.add_command(test_data_group)
|
|
52
|
+
cli.add_command(tags_group)
|
|
53
|
+
cli.add_command(environments_group)
|
|
50
54
|
# New command groups can be added here when implemented
|
|
51
55
|
|
|
52
56
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Environment management commands for TestZeus CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import click
|
|
7
|
+
import json
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from testzeus_sdk import TestZeusClient
|
|
10
|
+
from testzeus_cli.config import get_client_config
|
|
11
|
+
from testzeus_cli.utils.formatters import format_output
|
|
12
|
+
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
13
|
+
from testzeus_sdk.models import Environment
|
|
14
|
+
|
|
15
|
+
console = Console()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@click.group()
|
|
19
|
+
def environments_group():
|
|
20
|
+
"""Manage environments in TestZeus"""
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@environments_group.command()
|
|
25
|
+
@click.option("--name", required=True, help="Environment name")
|
|
26
|
+
@click.option("--data", help="Environment data (JSON string)")
|
|
27
|
+
@click.option("--tags", help="Comma-separated list of tags")
|
|
28
|
+
@click.pass_context
|
|
29
|
+
def create(ctx, name, data, tags):
|
|
30
|
+
"""Create a new environment"""
|
|
31
|
+
|
|
32
|
+
async def _run():
|
|
33
|
+
config, token = get_client_config(
|
|
34
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
35
|
+
)
|
|
36
|
+
client = TestZeusClient(**config)
|
|
37
|
+
async with client:
|
|
38
|
+
if token:
|
|
39
|
+
initialize_client_with_token(client, token)
|
|
40
|
+
else:
|
|
41
|
+
await client.ensure_authenticated()
|
|
42
|
+
params = {"name": name}
|
|
43
|
+
if data:
|
|
44
|
+
try:
|
|
45
|
+
params["data"] = json.loads(data)
|
|
46
|
+
except json.JSONDecodeError:
|
|
47
|
+
console.print("[red]Error: Invalid JSON data format[/red]")
|
|
48
|
+
raise click.Abort()
|
|
49
|
+
if tags:
|
|
50
|
+
params["tags"] = tags.split(",")
|
|
51
|
+
env = await client.environments.create(params)
|
|
52
|
+
return env.data
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
result = asyncio.run(_run())
|
|
56
|
+
console.print(
|
|
57
|
+
f"[green]Environment created successfully with ID: {result['id']}[/green]"
|
|
58
|
+
)
|
|
59
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
60
|
+
except Exception as e:
|
|
61
|
+
console.print(f"[red]Error creating environment: {str(e)}[/red]")
|
|
62
|
+
raise click.Abort()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@environments_group.command()
|
|
66
|
+
@click.pass_context
|
|
67
|
+
def list(ctx):
|
|
68
|
+
"""List all environments"""
|
|
69
|
+
|
|
70
|
+
async def _run():
|
|
71
|
+
config, token = get_client_config(
|
|
72
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
73
|
+
)
|
|
74
|
+
client = TestZeusClient(**config)
|
|
75
|
+
async with client:
|
|
76
|
+
if token:
|
|
77
|
+
initialize_client_with_token(client, token)
|
|
78
|
+
else:
|
|
79
|
+
await client.ensure_authenticated()
|
|
80
|
+
result = await client.environments.get_list()
|
|
81
|
+
|
|
82
|
+
return result
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
result = asyncio.run(_run())
|
|
86
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
87
|
+
except Exception as e:
|
|
88
|
+
console.print(f"[red]Error listing environments: {str(e)}[/red]")
|
|
89
|
+
raise click.Abort()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@environments_group.command()
|
|
93
|
+
@click.argument("env_id")
|
|
94
|
+
@click.pass_context
|
|
95
|
+
def delete(ctx, env_id):
|
|
96
|
+
"""Delete an environment"""
|
|
97
|
+
|
|
98
|
+
async def _run():
|
|
99
|
+
config, token = get_client_config(
|
|
100
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
101
|
+
)
|
|
102
|
+
client = TestZeusClient(**config)
|
|
103
|
+
async with client:
|
|
104
|
+
if token:
|
|
105
|
+
initialize_client_with_token(client, token)
|
|
106
|
+
else:
|
|
107
|
+
await client.ensure_authenticated()
|
|
108
|
+
await client.environments.delete(env_id)
|
|
109
|
+
return {"id": env_id}
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
result = asyncio.run(_run())
|
|
113
|
+
console.print(f"[green]Environment {result['id']} deleted successfully[/green]")
|
|
114
|
+
except Exception as e:
|
|
115
|
+
console.print(f"[red]Error deleting environment: {str(e)}[/red]")
|
|
116
|
+
raise click.Abort()
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tag management commands for TestZeus CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import click
|
|
7
|
+
import json
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from testzeus_sdk import TestZeusClient
|
|
10
|
+
from testzeus_cli.config import get_client_config
|
|
11
|
+
from testzeus_cli.utils.formatters import format_output
|
|
12
|
+
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
13
|
+
|
|
14
|
+
console = Console()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@click.group()
|
|
18
|
+
def tags_group():
|
|
19
|
+
"""Manage tags in TestZeus"""
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@tags_group.command()
|
|
24
|
+
@click.argument("name")
|
|
25
|
+
@click.pass_context
|
|
26
|
+
def create(ctx, name):
|
|
27
|
+
"""Create a new tag"""
|
|
28
|
+
|
|
29
|
+
async def _run():
|
|
30
|
+
config, token = get_client_config(
|
|
31
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
32
|
+
)
|
|
33
|
+
client = TestZeusClient(**config)
|
|
34
|
+
async with client:
|
|
35
|
+
if token:
|
|
36
|
+
initialize_client_with_token(client, token)
|
|
37
|
+
else:
|
|
38
|
+
await client.ensure_authenticated()
|
|
39
|
+
params = {"name": name}
|
|
40
|
+
tag = await client.tags.create(params)
|
|
41
|
+
return tag.data
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
result = asyncio.run(_run())
|
|
45
|
+
console.print(f"[green]Tag '{result['name']}' created successfully[/green]")
|
|
46
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
47
|
+
except Exception as e:
|
|
48
|
+
console.print(f"[red]Error creating tag: {str(e)}[/red]")
|
|
49
|
+
raise click.Abort()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@tags_group.command()
|
|
53
|
+
@click.pass_context
|
|
54
|
+
def list(ctx):
|
|
55
|
+
"""List all tags"""
|
|
56
|
+
|
|
57
|
+
async def _run():
|
|
58
|
+
config, token = get_client_config(
|
|
59
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
60
|
+
)
|
|
61
|
+
client = TestZeusClient(**config)
|
|
62
|
+
async with client:
|
|
63
|
+
if token:
|
|
64
|
+
initialize_client_with_token(client, token)
|
|
65
|
+
else:
|
|
66
|
+
await client.ensure_authenticated()
|
|
67
|
+
result = await client.tags.get_list()
|
|
68
|
+
|
|
69
|
+
return result
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
result = asyncio.run(_run())
|
|
73
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
74
|
+
except Exception as e:
|
|
75
|
+
console.print(f"[red]Error listing tags: {str(e)}[/red]")
|
|
76
|
+
raise click.Abort()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@tags_group.command()
|
|
80
|
+
@click.argument("name")
|
|
81
|
+
@click.pass_context
|
|
82
|
+
def delete(ctx, name):
|
|
83
|
+
"""Delete a tag"""
|
|
84
|
+
|
|
85
|
+
async def _run():
|
|
86
|
+
config, token = get_client_config(
|
|
87
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
88
|
+
)
|
|
89
|
+
client = TestZeusClient(**config)
|
|
90
|
+
async with client:
|
|
91
|
+
if token:
|
|
92
|
+
initialize_client_with_token(client, token)
|
|
93
|
+
else:
|
|
94
|
+
await client.ensure_authenticated()
|
|
95
|
+
await client.tags.delete(name)
|
|
96
|
+
return {"name": name}
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
result = asyncio.run(_run())
|
|
100
|
+
console.print(f"[green]Tag '{result['name']}' deleted successfully[/green]")
|
|
101
|
+
except Exception as e:
|
|
102
|
+
console.print(f"[red]Error deleting tag: {str(e)}[/red]")
|
|
103
|
+
raise click.Abort()
|
|
@@ -29,8 +29,10 @@ def test_runs_group():
|
|
|
29
29
|
@test_runs_group.command(name="create")
|
|
30
30
|
@click.option("--name", required=True, help="Test run name")
|
|
31
31
|
@click.option("--test", required=True, help="Test ID or name")
|
|
32
|
+
@click.option("--env", help="Environment ID")
|
|
33
|
+
@click.option("--tag", help="Tag name")
|
|
32
34
|
@click.pass_context
|
|
33
|
-
def create_test_run(ctx, name, test):
|
|
35
|
+
def create_test_run(ctx, name, test, env, tag):
|
|
34
36
|
"""Create and start a test run"""
|
|
35
37
|
|
|
36
38
|
async def _run():
|
|
@@ -108,6 +110,14 @@ def create_test_run(ctx, name, test):
|
|
|
108
110
|
# Create base parameters
|
|
109
111
|
params = {"name": unique_name, "test": test}
|
|
110
112
|
|
|
113
|
+
# Add environment if provided
|
|
114
|
+
if env:
|
|
115
|
+
params["environment"] = env
|
|
116
|
+
|
|
117
|
+
# Add tag if provided
|
|
118
|
+
if tag:
|
|
119
|
+
params["tag"] = tag
|
|
120
|
+
|
|
111
121
|
# Only set tenant if it's a valid ID (not the default PocketBase one)
|
|
112
122
|
if tenant_id and tenant_id != "_pb_users_auth_":
|
|
113
123
|
params["tenant"] = tenant_id
|
|
@@ -405,3 +415,37 @@ def download_attachments(ctx, test_run_id, output_dir):
|
|
|
405
415
|
else:
|
|
406
416
|
console.print(f"[red]Failed to download attachments:[/red] {str(e)}")
|
|
407
417
|
exit(1)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
@test_runs_group.command(name="status")
|
|
421
|
+
@click.argument("test_run_id")
|
|
422
|
+
@click.pass_context
|
|
423
|
+
def get_test_run_status(ctx, test_run_id):
|
|
424
|
+
"""Get the status of a test run"""
|
|
425
|
+
|
|
426
|
+
async def _run():
|
|
427
|
+
config, token = get_client_config(
|
|
428
|
+
ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
|
|
429
|
+
)
|
|
430
|
+
client = TestZeusClient(**config)
|
|
431
|
+
|
|
432
|
+
test_run_id_validated = validate_id(test_run_id, "test run")
|
|
433
|
+
|
|
434
|
+
async with client:
|
|
435
|
+
# Apply token from config if available
|
|
436
|
+
if token:
|
|
437
|
+
initialize_client_with_token(client, token)
|
|
438
|
+
else:
|
|
439
|
+
await client.ensure_authenticated()
|
|
440
|
+
|
|
441
|
+
test_run = await client.test_runs.get_one(test_run_id_validated)
|
|
442
|
+
return {
|
|
443
|
+
"id": test_run.data["id"],
|
|
444
|
+
"status": test_run.data["status"],
|
|
445
|
+
"result": test_run.data.get("result"),
|
|
446
|
+
"created": test_run.data["created"],
|
|
447
|
+
"updated": test_run.data["updated"],
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
result = asyncio.run(_run())
|
|
451
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
@@ -33,6 +33,7 @@ def format_output(data: Any, format_type: str = "table") -> None:
|
|
|
33
33
|
elif format_type == "yaml":
|
|
34
34
|
console.print(yaml.dump(data, sort_keys=False, default_flow_style=False))
|
|
35
35
|
else: # table format
|
|
36
|
+
|
|
36
37
|
if isinstance(data, dict):
|
|
37
38
|
format_dict_as_table(data)
|
|
38
39
|
elif isinstance(data, list):
|
|
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
|