testzeus-cli 0.0.21__tar.gz → 0.0.22__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.
Files changed (36) hide show
  1. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/PKG-INFO +1 -1
  2. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/pyproject.toml +1 -1
  3. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/environments.py +4 -9
  4. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/hypermind_code_blocks.py +3 -11
  5. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_data.py +4 -9
  6. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_run_groups.py +3 -5
  7. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_suite_schedules.py +2 -2
  8. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_suites.py +2 -2
  9. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/user_integrations.py +5 -3
  10. testzeus_cli-0.0.22/testzeus_cli/utils/files.py +45 -0
  11. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/LICENSE +0 -0
  12. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/README.md +0 -0
  13. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/__init__.py +0 -0
  14. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/auth.py +0 -0
  15. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/cli.py +0 -0
  16. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/__init__.py +0 -0
  17. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/daemon.py +0 -0
  18. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/device_pool.py +0 -0
  19. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/extensions.py +0 -0
  20. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/knowledge_bases.py +0 -0
  21. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/notification_channels.py +0 -0
  22. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/tags.py +0 -0
  23. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_report_schedules.py +0 -0
  24. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_runs.py +0 -0
  25. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_suite_node_runs.py +0 -0
  26. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/test_suite_runs.py +0 -0
  27. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/tests.py +0 -0
  28. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/tests_ai_generator.py +0 -0
  29. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/commands/tests_authoring.py +0 -0
  30. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/config.py +0 -0
  31. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/__init__.py +0 -0
  32. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/auth.py +0 -0
  33. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/client.py +0 -0
  34. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/formatters.py +0 -0
  35. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/profile.py +0 -0
  36. {testzeus_cli-0.0.21 → testzeus_cli-0.0.22}/testzeus_cli/utils/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testzeus-cli
3
- Version: 0.0.21
3
+ Version: 0.0.22
4
4
  Summary: Command-line interface for TestZeus testing platform
5
5
  License-File: LICENSE
6
6
  Author: Shriyansh Agnihotri
@@ -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.21"
7
+ version = "0.0.22"
8
8
  description = "Command-line interface for TestZeus testing platform"
9
9
  authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
10
10
  readme = "README.md"
@@ -14,6 +14,7 @@ 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
17
18
 
18
19
  console = Console()
19
20
 
@@ -652,15 +653,9 @@ def remove_file(ctx, env_id, file_path):
652
653
  env_data = await client.environments.get_one(env_id)
653
654
  validate_tenant_ownership(env_data.data, tenant_id, "environment")
654
655
 
655
- file_name = None
656
- if env_data.supporting_data_files:
657
- for file in env_data.supporting_data_files:
658
- if (
659
- file_path.split("/")[-1].split(".")[0].lower()
660
- == file.split("_")[0].lower()
661
- ):
662
- file_name = file
663
- break
656
+ file_name = match_stored_file(env_data.supporting_data_files or [], file_path)
657
+ if not file_name:
658
+ raise ValueError(f"File not found in environment: {file_path}")
664
659
  params = {
665
660
  "supporting_data_files-": [file_name],
666
661
  "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, 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
15
16
  from pocketbase.client import FileUpload
16
17
 
17
18
  console = Console()
@@ -378,17 +379,8 @@ def remove_file(ctx, code_block_id, file_path):
378
379
  await client.ensure_authenticated()
379
380
 
380
381
  code_block_data = await client.hypermind_code_blocks.get_one(code_block_id_validated)
381
- file_name = None
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
-
382
+ file_name = match_stored_file(code_block_data.code_files or [], file_path)
383
+
392
384
  if not file_name:
393
385
  print_message(f"[yellow]File not found: {file_path}[/yellow]", ctx.obj["FORMAT"])
394
386
  return None
@@ -14,6 +14,7 @@ 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
17
18
  from pocketbase.client import FileUpload
18
19
 
19
20
  console = Console()
@@ -443,15 +444,9 @@ def remove_file(ctx, test_data_id, file_path):
443
444
  test_data_data = await client.test_data.get_one(test_data_id)
444
445
  validate_tenant_ownership(test_data_data.data, tenant_id, "test data")
445
446
 
446
- file_name = None
447
- if test_data_data.supporting_data_files:
448
- for file in test_data_data.supporting_data_files:
449
- if (
450
- file_path.split("/")[-1].split(".")[0].lower()
451
- == file.split("_")[0].lower()
452
- ):
453
- file_name = file
454
- break
447
+ file_name = match_stored_file(test_data_data.supporting_data_files or [], file_path)
448
+ if not file_name:
449
+ raise ValueError(f"File not found in test data: {file_path}")
455
450
  params = {
456
451
  "supporting_data_files-": [file_name],
457
452
  "tenant": tenant_id,
@@ -248,7 +248,7 @@ def cancel_test_run_group(ctx, test_run_group_id):
248
248
 
249
249
  async with client:
250
250
  if token:
251
- initialize_client_with_token(client, token)
251
+ initialize_client_with_token(client, token, stored_tenant_id)
252
252
  else:
253
253
  await client.ensure_authenticated()
254
254
 
@@ -261,10 +261,8 @@ def cancel_test_run_group(ctx, test_run_group_id):
261
261
  f"[blue]Cancelling test run group: {test_run_group_id_validated}[/blue]"
262
262
  )
263
263
 
264
- result = await client.test_run_groups.cancel(
265
- test_run_group_id_validated,
266
- tenant=stored_tenant_id,
267
- modified_by=stored_user_id,
264
+ result = await client.test_run_groups.cancel_group(
265
+ test_run_group_id_validated
268
266
  )
269
267
  return result.data if hasattr(result, "data") else result
270
268
 
@@ -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, _, _ = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
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:
@@ -184,10 +184,10 @@ def update_test_suite(
184
184
  input_schema_value = _parse_json_value(input_schema, "--input-schema") if input_schema else None
185
185
 
186
186
  async def _run():
187
- config, token, _, _ = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
187
+ config, token, tenant_id, user_id = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
188
188
  client = TestZeusClient(**config)
189
189
  suite_id_validated = validate_id(suite_id, "test suite")
190
- payload = {}
190
+ payload = {"tenant": tenant_id, "modified_by": user_id}
191
191
  if name is not None:
192
192
  payload["name"] = name
193
193
  if workflow_definition_value is not None:
@@ -108,10 +108,12 @@ def get_first_user_integration(ctx, filters, sort, expand):
108
108
  if token:
109
109
  initialize_client_with_token(client, token)
110
110
 
111
- integration = await client.user_integrations.get_first_item(
112
- expand=expand, sort=sort, filters=filter_dict
111
+ result = await client.user_integrations.get_list(
112
+ expand=expand, sort=sort, filters=filter_dict, per_page=1
113
113
  )
114
-
114
+ items = result.get("items", [])
115
+ integration = items[0] if items else None
116
+
115
117
  if integration:
116
118
  return integration.data
117
119
  else:
@@ -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
File without changes
File without changes