testzeus-cli 0.0.9__tar.gz → 0.0.11__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 (20) hide show
  1. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/PKG-INFO +183 -9
  2. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/README.md +180 -7
  3. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/pyproject.toml +4 -2
  4. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/auth.py +1 -2
  5. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/cli.py +0 -1
  6. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/environments.py +188 -16
  7. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/tags.py +10 -4
  8. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/test_data.py +106 -19
  9. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/test_runs.py +18 -4
  10. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/tests.py +15 -4
  11. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/config.py +0 -1
  12. testzeus_cli-0.0.11/testzeus_cli/utils/__init__.py +3 -0
  13. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/utils/client.py +1 -1
  14. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/utils/formatters.py +2 -2
  15. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/utils/validators.py +10 -3
  16. testzeus_cli-0.0.9/testzeus_cli/utils/__init__.py +0 -7
  17. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/LICENSE +0 -0
  18. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/__init__.py +0 -0
  19. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/commands/__init__.py +0 -0
  20. {testzeus_cli-0.0.9 → testzeus_cli-0.0.11}/testzeus_cli/utils/auth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: testzeus-cli
3
- Version: 0.0.9
3
+ Version: 0.0.11
4
4
  Summary: Command-line interface for TestZeus testing platform
5
5
  Author: Shriyansh Agnihotri
6
6
  Author-email: shriyansh@testzeus.com
@@ -13,10 +13,11 @@ Classifier: Programming Language :: Python :: 3.13
13
13
  Requires-Dist: click (>=8.1.3,<9.0.0)
14
14
  Requires-Dist: ipdb (>=0.13.13,<0.14.0)
15
15
  Requires-Dist: keyring (>=24.0.0,<25.0.0)
16
+ Requires-Dist: pocketbase (>=0.15.0,<0.16.0)
16
17
  Requires-Dist: pydantic (>=2.0.0,<3.0.0)
17
18
  Requires-Dist: pyyaml (>=6.0,<7.0)
18
19
  Requires-Dist: rich (>=13.3.1,<14.0.0)
19
- Requires-Dist: testzeus-sdk (>=0.0.9,<0.0.10)
20
+ Requires-Dist: testzeus-sdk (>=0.0.11,<0.0.12)
20
21
  Project-URL: Repository, https://github.com/test-zeus-ai/testzeus-cli
21
22
  Description-Content-Type: text/markdown
22
23
 
@@ -106,7 +107,7 @@ testzeus tests create --name "My Test" --feature-file ./features.txt
106
107
 
107
108
  Additional options:
108
109
  ```bash
109
- testzeus tests create --name "My Test" --feature-file ./features.txt --status ready --data data_id1 --data data_id2 --tags tag1 --tags tag2 --environment env_id
110
+ testzeus tests create --name "My Test" --feature-file ./features.txt --status ready --data data_id1 --data data_id2 --tags tag1 --tags tag2 --environment env_id --execution-mode strict
110
111
  ```
111
112
 
112
113
  ### Update Test
@@ -172,6 +173,12 @@ testzeus test-runs get-expanded <run-id>
172
173
  testzeus test-runs create --name "Run 1" --test <test-id>
173
174
  ```
174
175
 
176
+ Create test run with environment or tag:
177
+
178
+ ```bash
179
+ testzeus test-runs create --name "Run 1" --test <test-id> --env <env-id> --tag <tag-name>
180
+ ```
181
+
175
182
  ### Cancel Test Run
176
183
 
177
184
  ```bash
@@ -185,6 +192,12 @@ testzeus test-runs watch <run-id>
185
192
  testzeus test-runs watch <run-id> --interval 10
186
193
  ```
187
194
 
195
+ ### Get Test Run Status
196
+
197
+ ```bash
198
+ testzeus test-runs status <run-id>
199
+ ```
200
+
188
201
  ### Download Test Run Attachments
189
202
 
190
203
  ```bash
@@ -217,18 +230,18 @@ testzeus test-data get <data-id> --expand related_entities
217
230
  Create with inline content:
218
231
 
219
232
  ```bash
220
- testzeus test-data create --name "Test Data 1" --input-data "{\"key\":\"value\"}"
233
+ testzeus test-data create --name "Test Data 1" --data "{\"key\":\"value\"}"
221
234
  ```
222
235
 
223
236
  Create with data from a file:
224
237
 
225
238
  ```bash
226
- testzeus test-data create --name "Test Data" --file ./data.json
239
+ testzeus test-data create --name "Test Data" --data-file ./data.json
227
240
  ```
228
241
 
229
242
  Additional options:
230
243
  ```bash
231
- testzeus test-data create --name "Test Data" --type test --status ready --file ./data.json
244
+ testzeus test-data create --name "Test Data" --type test --status ready --data-file ./data.json
232
245
  ```
233
246
 
234
247
  ### Update Test Data
@@ -242,13 +255,13 @@ testzeus test-data update <data-id> --name "New Data Name" --type updated --stat
242
255
  Update data content from text:
243
256
 
244
257
  ```bash
245
- testzeus test-data update <data-id> --input-data "{\"key\":\"updated\"}"
258
+ testzeus test-data update <data-id> --data "{\"key\":\"updated\"}"
246
259
  ```
247
260
 
248
261
  Update data content from a file:
249
262
 
250
263
  ```bash
251
- testzeus test-data update <data-id> --file ./updated_data.json
264
+ testzeus test-data update <data-id> --data-file ./updated_data.json
252
265
  ```
253
266
 
254
267
  ### Delete Test Data
@@ -257,6 +270,143 @@ testzeus test-data update <data-id> --file ./updated_data.json
257
270
  testzeus test-data delete <data-id>
258
271
  ```
259
272
 
273
+ ### File Management for Test Data
274
+
275
+ Upload a file to test data:
276
+
277
+ ```bash
278
+ testzeus test-data upload-file <data-id> <file-path>
279
+ ```
280
+
281
+ Delete all files from test data:
282
+
283
+ ```bash
284
+ testzeus test-data delete-all-files <data-id>
285
+ ```
286
+
287
+ ## Environments
288
+
289
+ ### List Environments
290
+
291
+ ```bash
292
+ testzeus environments list
293
+ ```
294
+
295
+ Filter environments:
296
+ ```bash
297
+ testzeus environments list --filters status=ready
298
+ ```
299
+
300
+ ### Get Environment Details
301
+
302
+ ```bash
303
+ testzeus environments get <env-id>
304
+ testzeus environments get <env-id> --expand related_entities
305
+ ```
306
+
307
+ ### Create Environment
308
+
309
+ Create with inline data:
310
+
311
+ ```bash
312
+ testzeus environments create --name "Test Environment" --data "{\"key\":\"value\"}"
313
+ ```
314
+
315
+ Create with data from a file:
316
+
317
+ ```bash
318
+ testzeus environments create --name "Test Environment" --data-file ./env_data.json
319
+ ```
320
+
321
+ Additional options:
322
+ ```bash
323
+ testzeus environments create --name "Test Environment" --status ready --data-file ./env_data.json --tags "tag1,tag2"
324
+ ```
325
+
326
+ ### Update Environment
327
+
328
+ Update environment properties:
329
+
330
+ ```bash
331
+ testzeus environments update <env-id> --name "New Name" --status ready
332
+ ```
333
+
334
+ Update environment data:
335
+
336
+ ```bash
337
+ testzeus environments update <env-id> --data "{\"key\":\"updated\"}"
338
+ testzeus environments update <env-id> --data-file ./updated_env_data.json
339
+ ```
340
+
341
+ ### Delete Environment
342
+
343
+ ```bash
344
+ testzeus environments delete <env-id>
345
+ ```
346
+
347
+ ### File Management for Environments
348
+
349
+ Upload a file to environment:
350
+
351
+ ```bash
352
+ testzeus environments upload-file <env-id> <file-path>
353
+ ```
354
+
355
+ Remove a file from environment:
356
+
357
+ ```bash
358
+ testzeus environments remove-file <env-id> <file-path>
359
+ ```
360
+
361
+ Delete all files from environment:
362
+
363
+ ```bash
364
+ testzeus environments delete-all-files <env-id>
365
+ ```
366
+
367
+ ## Tags
368
+
369
+ ### List Tags
370
+
371
+ ```bash
372
+ testzeus tags list
373
+ ```
374
+
375
+ Filter tags:
376
+ ```bash
377
+ testzeus tags list --filters name=test
378
+ ```
379
+
380
+ ### Get Tag Details
381
+
382
+ ```bash
383
+ testzeus tags get <tag-id>
384
+ ```
385
+
386
+ ### Create Tag
387
+
388
+ ```bash
389
+ testzeus tags create --name "test-tag" --value "test-value"
390
+ ```
391
+
392
+ Create tag without value:
393
+
394
+ ```bash
395
+ testzeus tags create --name "simple-tag"
396
+ ```
397
+
398
+ ### Update Tag
399
+
400
+ ```bash
401
+ testzeus tags update <tag-id> --name "new-name" --value "new-value"
402
+ ```
403
+
404
+ ### Delete Tag
405
+
406
+ ```bash
407
+ testzeus tags delete <tag-name>
408
+ ```
409
+
260
410
  ## Configuration
261
411
 
262
412
  The CLI stores configuration and credentials in your user's config directory. Different profiles can be used to manage multiple TestZeus environments.
@@ -276,7 +426,7 @@ Passwords are securely stored in your system's keyring.
276
426
  testzeus login
277
427
 
278
428
  # Create test data
279
- testzeus test-data create --name "User Data" --input-data "{\"username\":\"testuser\"}"
429
+ testzeus test-data create --name "User Data" --data "{\"username\":\"testuser\"}"
280
430
 
281
431
  # Create a new test with features from a file
282
432
  testzeus tests create --name "Login Test" --feature-file ./features/login.feature --data <test_data_id>
@@ -294,6 +444,30 @@ testzeus test-runs get-expanded <test_run_id>
294
444
  testzeus test-runs download-attachments <test_run_id> --output-dir ./results
295
445
  ```
296
446
 
447
+ ### Working with Environments
448
+
449
+ ```bash
450
+ # Create an environment with data
451
+ testzeus environments create --name "Production Environment" --data-file ./prod_config.json --status ready
452
+
453
+ # Upload additional files to the environment
454
+ testzeus environments upload-file <env-id> ./additional_config.yaml
455
+
456
+ # Create a test that uses the environment
457
+ testzeus tests create --name "Production Test" --feature-file ./test.feature --environment <env-id>
458
+ ```
459
+
460
+ ### Managing Tags
461
+
462
+ ```bash
463
+ # Create tags for organizing tests
464
+ testzeus tags create --name "regression" --value "suite"
465
+ testzeus tags create --name "priority" --value "high"
466
+
467
+ # Create a test with tags
468
+ testzeus tests create --name "Critical Test" --feature-file ./critical.feature --tags tag1 --tags tag2
469
+ ```
470
+
297
471
  ## Error Handling
298
472
 
299
473
  When an error occurs, the CLI will display an error message. For more detailed information, run any command with the `--verbose` flag:
@@ -84,7 +84,7 @@ testzeus tests create --name "My Test" --feature-file ./features.txt
84
84
 
85
85
  Additional options:
86
86
  ```bash
87
- testzeus tests create --name "My Test" --feature-file ./features.txt --status ready --data data_id1 --data data_id2 --tags tag1 --tags tag2 --environment env_id
87
+ testzeus tests create --name "My Test" --feature-file ./features.txt --status ready --data data_id1 --data data_id2 --tags tag1 --tags tag2 --environment env_id --execution-mode strict
88
88
  ```
89
89
 
90
90
  ### Update Test
@@ -150,6 +150,12 @@ testzeus test-runs get-expanded <run-id>
150
150
  testzeus test-runs create --name "Run 1" --test <test-id>
151
151
  ```
152
152
 
153
+ Create test run with environment or tag:
154
+
155
+ ```bash
156
+ testzeus test-runs create --name "Run 1" --test <test-id> --env <env-id> --tag <tag-name>
157
+ ```
158
+
153
159
  ### Cancel Test Run
154
160
 
155
161
  ```bash
@@ -163,6 +169,12 @@ testzeus test-runs watch <run-id>
163
169
  testzeus test-runs watch <run-id> --interval 10
164
170
  ```
165
171
 
172
+ ### Get Test Run Status
173
+
174
+ ```bash
175
+ testzeus test-runs status <run-id>
176
+ ```
177
+
166
178
  ### Download Test Run Attachments
167
179
 
168
180
  ```bash
@@ -195,18 +207,18 @@ testzeus test-data get <data-id> --expand related_entities
195
207
  Create with inline content:
196
208
 
197
209
  ```bash
198
- testzeus test-data create --name "Test Data 1" --input-data "{\"key\":\"value\"}"
210
+ testzeus test-data create --name "Test Data 1" --data "{\"key\":\"value\"}"
199
211
  ```
200
212
 
201
213
  Create with data from a file:
202
214
 
203
215
  ```bash
204
- testzeus test-data create --name "Test Data" --file ./data.json
216
+ testzeus test-data create --name "Test Data" --data-file ./data.json
205
217
  ```
206
218
 
207
219
  Additional options:
208
220
  ```bash
209
- testzeus test-data create --name "Test Data" --type test --status ready --file ./data.json
221
+ testzeus test-data create --name "Test Data" --type test --status ready --data-file ./data.json
210
222
  ```
211
223
 
212
224
  ### Update Test Data
@@ -220,13 +232,13 @@ testzeus test-data update <data-id> --name "New Data Name" --type updated --stat
220
232
  Update data content from text:
221
233
 
222
234
  ```bash
223
- testzeus test-data update <data-id> --input-data "{\"key\":\"updated\"}"
235
+ testzeus test-data update <data-id> --data "{\"key\":\"updated\"}"
224
236
  ```
225
237
 
226
238
  Update data content from a file:
227
239
 
228
240
  ```bash
229
- testzeus test-data update <data-id> --file ./updated_data.json
241
+ testzeus test-data update <data-id> --data-file ./updated_data.json
230
242
  ```
231
243
 
232
244
  ### Delete Test Data
@@ -235,6 +247,143 @@ testzeus test-data update <data-id> --file ./updated_data.json
235
247
  testzeus test-data delete <data-id>
236
248
  ```
237
249
 
250
+ ### File Management for Test Data
251
+
252
+ Upload a file to test data:
253
+
254
+ ```bash
255
+ testzeus test-data upload-file <data-id> <file-path>
256
+ ```
257
+
258
+ Delete all files from test data:
259
+
260
+ ```bash
261
+ testzeus test-data delete-all-files <data-id>
262
+ ```
263
+
264
+ ## Environments
265
+
266
+ ### List Environments
267
+
268
+ ```bash
269
+ testzeus environments list
270
+ ```
271
+
272
+ Filter environments:
273
+ ```bash
274
+ testzeus environments list --filters status=ready
275
+ ```
276
+
277
+ ### Get Environment Details
278
+
279
+ ```bash
280
+ testzeus environments get <env-id>
281
+ testzeus environments get <env-id> --expand related_entities
282
+ ```
283
+
284
+ ### Create Environment
285
+
286
+ Create with inline data:
287
+
288
+ ```bash
289
+ testzeus environments create --name "Test Environment" --data "{\"key\":\"value\"}"
290
+ ```
291
+
292
+ Create with data from a file:
293
+
294
+ ```bash
295
+ testzeus environments create --name "Test Environment" --data-file ./env_data.json
296
+ ```
297
+
298
+ Additional options:
299
+ ```bash
300
+ testzeus environments create --name "Test Environment" --status ready --data-file ./env_data.json --tags "tag1,tag2"
301
+ ```
302
+
303
+ ### Update Environment
304
+
305
+ Update environment properties:
306
+
307
+ ```bash
308
+ testzeus environments update <env-id> --name "New Name" --status ready
309
+ ```
310
+
311
+ Update environment data:
312
+
313
+ ```bash
314
+ testzeus environments update <env-id> --data "{\"key\":\"updated\"}"
315
+ testzeus environments update <env-id> --data-file ./updated_env_data.json
316
+ ```
317
+
318
+ ### Delete Environment
319
+
320
+ ```bash
321
+ testzeus environments delete <env-id>
322
+ ```
323
+
324
+ ### File Management for Environments
325
+
326
+ Upload a file to environment:
327
+
328
+ ```bash
329
+ testzeus environments upload-file <env-id> <file-path>
330
+ ```
331
+
332
+ Remove a file from environment:
333
+
334
+ ```bash
335
+ testzeus environments remove-file <env-id> <file-path>
336
+ ```
337
+
338
+ Delete all files from environment:
339
+
340
+ ```bash
341
+ testzeus environments delete-all-files <env-id>
342
+ ```
343
+
344
+ ## Tags
345
+
346
+ ### List Tags
347
+
348
+ ```bash
349
+ testzeus tags list
350
+ ```
351
+
352
+ Filter tags:
353
+ ```bash
354
+ testzeus tags list --filters name=test
355
+ ```
356
+
357
+ ### Get Tag Details
358
+
359
+ ```bash
360
+ testzeus tags get <tag-id>
361
+ ```
362
+
363
+ ### Create Tag
364
+
365
+ ```bash
366
+ testzeus tags create --name "test-tag" --value "test-value"
367
+ ```
368
+
369
+ Create tag without value:
370
+
371
+ ```bash
372
+ testzeus tags create --name "simple-tag"
373
+ ```
374
+
375
+ ### Update Tag
376
+
377
+ ```bash
378
+ testzeus tags update <tag-id> --name "new-name" --value "new-value"
379
+ ```
380
+
381
+ ### Delete Tag
382
+
383
+ ```bash
384
+ testzeus tags delete <tag-name>
385
+ ```
386
+
238
387
  ## Configuration
239
388
 
240
389
  The CLI stores configuration and credentials in your user's config directory. Different profiles can be used to manage multiple TestZeus environments.
@@ -254,7 +403,7 @@ Passwords are securely stored in your system's keyring.
254
403
  testzeus login
255
404
 
256
405
  # Create test data
257
- testzeus test-data create --name "User Data" --input-data "{\"username\":\"testuser\"}"
406
+ testzeus test-data create --name "User Data" --data "{\"username\":\"testuser\"}"
258
407
 
259
408
  # Create a new test with features from a file
260
409
  testzeus tests create --name "Login Test" --feature-file ./features/login.feature --data <test_data_id>
@@ -272,6 +421,30 @@ testzeus test-runs get-expanded <test_run_id>
272
421
  testzeus test-runs download-attachments <test_run_id> --output-dir ./results
273
422
  ```
274
423
 
424
+ ### Working with Environments
425
+
426
+ ```bash
427
+ # Create an environment with data
428
+ testzeus environments create --name "Production Environment" --data-file ./prod_config.json --status ready
429
+
430
+ # Upload additional files to the environment
431
+ testzeus environments upload-file <env-id> ./additional_config.yaml
432
+
433
+ # Create a test that uses the environment
434
+ testzeus tests create --name "Production Test" --feature-file ./test.feature --environment <env-id>
435
+ ```
436
+
437
+ ### Managing Tags
438
+
439
+ ```bash
440
+ # Create tags for organizing tests
441
+ testzeus tags create --name "regression" --value "suite"
442
+ testzeus tags create --name "priority" --value "high"
443
+
444
+ # Create a test with tags
445
+ testzeus tests create --name "Critical Test" --feature-file ./critical.feature --tags tag1 --tags tag2
446
+ ```
447
+
275
448
  ## Error Handling
276
449
 
277
450
  When an error occurs, the CLI will display an error message. For more detailed information, run any command with the `--verbose` flag:
@@ -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.9"
7
+ version = "0.0.11"
8
8
  description = "Command-line interface for TestZeus testing platform"
9
9
  authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
10
10
  readme = "README.md"
@@ -22,13 +22,15 @@ 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.9"
25
+ testzeus-sdk = "^0.0.11"
26
+ pocketbase = "^0.15.0"
26
27
 
27
28
  [tool.poetry.group.dev.dependencies]
28
29
  pytest = "^7.3.1"
29
30
  black = "^23.3.0"
30
31
  isort = "^5.12.0"
31
32
  python-dotenv = "^1.0.0"
33
+ ipykernel = "^6.29.5"
32
34
 
33
35
  [tool.poetry.scripts]
34
36
  testzeus = "testzeus_cli.cli:main"
@@ -11,7 +11,6 @@ from typing import Dict, Any, Optional
11
11
  from testzeus_sdk import TestZeusClient
12
12
  from testzeus_cli.config import update_config, get_client_config, clear_auth_data
13
13
  from testzeus_cli.utils.auth import (
14
- extract_tenant_from_token,
15
14
  initialize_client_with_token,
16
15
  )
17
16
 
@@ -102,7 +101,7 @@ def whoami_command(ctx: click.Context) -> None:
102
101
  config, token, stored_tenant_id, stored_user_id = get_client_config(
103
102
  ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
104
103
  )
105
-
104
+
106
105
  client = TestZeusClient(**config)
107
106
 
108
107
  try:
@@ -2,7 +2,6 @@
2
2
  TestZeus CLI - Command line interface for TestZeus testing platform.
3
3
  """
4
4
 
5
- import asyncio
6
5
  import sys
7
6
  import click
8
7
  from rich.console import Console
@@ -6,6 +6,7 @@ import asyncio
6
6
  import click
7
7
  from pathlib import Path
8
8
  from rich.console import Console
9
+ from pocketbase.client import FileUpload
9
10
  from testzeus_sdk import TestZeusClient
10
11
  from testzeus_cli.config import get_client_config
11
12
  from testzeus_cli.utils.formatters import format_output
@@ -14,6 +15,7 @@ from testzeus_cli.utils.validators import parse_key_value_pairs
14
15
 
15
16
  console = Console()
16
17
 
18
+
17
19
  def _read_data_file(file_path: str) -> str:
18
20
  """
19
21
  Read data content from a file as plain text
@@ -35,6 +37,7 @@ def _read_data_file(file_path: str) -> str:
35
37
  # Always return the raw text content
36
38
  return content
37
39
 
40
+
38
41
  @click.group()
39
42
  def environments_group():
40
43
  """Manage environments in TestZeus"""
@@ -43,20 +46,33 @@ def environments_group():
43
46
 
44
47
  @environments_group.command(name="create")
45
48
  @click.option("--name", required=True, help="Environment name")
46
- @click.option("--status", default="draft", help="Environment status (draft, ready, deleted)")
49
+ @click.option(
50
+ "--status", default="draft", help="Environment status (draft, ready, deleted)"
51
+ )
47
52
  @click.option("--data", help="Environment data as text")
48
- @click.option("--data-file", "-df", type=click.Path(exists=True), help="Path to text file with environment data")
53
+ @click.option(
54
+ "--data-file",
55
+ "-df",
56
+ type=click.Path(exists=True),
57
+ help="Path to text file with environment data",
58
+ )
49
59
  @click.option("--tags", help="Comma-separated list of tags")
60
+ @click.option(
61
+ "--file",
62
+ "-f",
63
+ type=click.Path(exists=True),
64
+ help="Path to text file with environment data",
65
+ )
50
66
  @click.pass_context
51
- def create(ctx, name, status, data, data_file, tags):
67
+ def create(ctx, name, status, data, data_file, tags, file):
52
68
  """Create a new environment"""
53
-
69
+
54
70
  if data and data_file:
55
71
  raise click.UsageError("Cannot use both --data and --data-file")
56
-
72
+
57
73
  if not data and not data_file:
58
74
  raise click.UsageError("Either --data or --data-file is required")
59
-
75
+
60
76
  # Process the data content (from file or directly)
61
77
  data_content = _read_data_file(data_file) if data_file else data
62
78
 
@@ -71,15 +87,27 @@ def create(ctx, name, status, data, data_file, tags):
71
87
  initialize_client_with_token(client, token)
72
88
  else:
73
89
  await client.ensure_authenticated()
74
-
75
- params = {"name": name, "status": status, "tenant": stored_tenant_id, "modified_by": stored_user_id}
76
-
90
+
91
+ params = {
92
+ "name": name,
93
+ "status": status,
94
+ "tenant": stored_tenant_id,
95
+ "modified_by": stored_user_id,
96
+ }
97
+
77
98
  if data_content:
78
99
  params["data"] = data_content
79
100
 
80
101
  if tags:
81
102
  params["tags"] = tags.split(",")
82
-
103
+
104
+ if file:
105
+ try:
106
+ params["supporting_data_files"] = FileUpload(file, open(file, "rb"))
107
+ except Exception as e:
108
+ console.print(f"[red]Error reading file:[/red] {str(e)}")
109
+ exit(1)
110
+
83
111
  env = await client.environments.create(params)
84
112
  return env.data
85
113
 
@@ -95,7 +123,9 @@ def create(ctx, name, status, data, data_file, tags):
95
123
 
96
124
 
97
125
  @environments_group.command(name="list")
98
- @click.option("--filters", "-f", multiple=True, help="Filter results (format: key=value)")
126
+ @click.option(
127
+ "--filters", "-f", multiple=True, help="Filter results (format: key=value)"
128
+ )
99
129
  @click.option("--sort", help="Sort by field")
100
130
  @click.option("--expand", help="Expand related entities")
101
131
  @click.pass_context
@@ -152,6 +182,7 @@ def delete(ctx, env_id):
152
182
  console.print(f"[red]Error deleting environment: {str(e)}[/red]")
153
183
  raise click.Abort()
154
184
 
185
+
155
186
  @environments_group.command(name="get")
156
187
  @click.argument("env_id")
157
188
  @click.option("--expand", help="Expand related entities")
@@ -185,15 +216,26 @@ def get(ctx, env_id, expand):
185
216
  @click.option("--name", help="New environment name")
186
217
  @click.option("--status", help="New environment status (draft, ready, deleted)")
187
218
  @click.option("--data", help="New environment data as text")
188
- @click.option("--data-file", "-df", type=click.Path(exists=True), help="Path to text file with new environment data")
219
+ @click.option(
220
+ "--data-file",
221
+ "-df",
222
+ type=click.Path(exists=True),
223
+ help="Path to text file with new environment data",
224
+ )
189
225
  @click.option("--tags", help="Comma-separated list of tags")
226
+ @click.option(
227
+ "--file",
228
+ "-f",
229
+ type=click.Path(exists=True),
230
+ help="Path to text file with environment data",
231
+ )
190
232
  @click.pass_context
191
- def update(ctx, env_id, name, status, data, data_file, tags):
233
+ def update(ctx, env_id, name, status, data, data_file, tags, file):
192
234
  """Update an environment"""
193
235
 
194
236
  if data and data_file:
195
237
  raise click.UsageError("Cannot use both --data and --data-file")
196
-
238
+
197
239
  # Process the data content (from file or directly)
198
240
  data_content = None
199
241
  if data_file:
@@ -201,7 +243,6 @@ def update(ctx, env_id, name, status, data, data_file, tags):
201
243
  elif data:
202
244
  data_content = data
203
245
 
204
-
205
246
  async def _run():
206
247
  config, token, tenant_id, user_id = get_client_config(
207
248
  ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
@@ -235,6 +276,15 @@ def update(ctx, env_id, name, status, data, data_file, tags):
235
276
  updates["tags"] = None
236
277
  has_updates = True
237
278
 
279
+ if file:
280
+ try:
281
+ updates["supporting_data_files"] = FileUpload(
282
+ file, open(file, "rb")
283
+ )
284
+ except Exception as e:
285
+ console.print(f"[red]Error reading file:[/red] {str(e)}")
286
+ exit(1)
287
+
238
288
  if has_updates:
239
289
  updated_env = await client.environments.update(env_id, updates)
240
290
  return updated_env.data
@@ -244,8 +294,130 @@ def update(ctx, env_id, name, status, data, data_file, tags):
244
294
 
245
295
  try:
246
296
  result = asyncio.run(_run())
247
- console.print(f"[green]Environment updated successfully[/green]")
297
+ console.print("[green]Environment updated successfully[/green]")
248
298
  format_output(result, ctx.obj["FORMAT"])
249
299
  except Exception as e:
250
300
  console.print(f"[red]Error updating environment: {str(e)}[/red]")
251
301
  raise click.Abort()
302
+
303
+
304
+ @environments_group.command(
305
+ name="upload-file", help="Upload a file to an environment using ID and file path"
306
+ )
307
+ @click.argument("env_id")
308
+ @click.argument("file_path")
309
+ @click.pass_context
310
+ def upload_file(ctx, env_id, file_path):
311
+ """Upload a file to an environment"""
312
+
313
+ async def _run():
314
+ config, token, tenant_id, user_id = get_client_config(
315
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
316
+ )
317
+ client = TestZeusClient(**config)
318
+ async with client:
319
+ if token:
320
+ initialize_client_with_token(client, token)
321
+ else:
322
+ await client.ensure_authenticated()
323
+ file_path_validated = Path(file_path)
324
+ if not file_path_validated.exists():
325
+ console.print(f"[red]File not found:[/red] {file_path}")
326
+ exit(1)
327
+ params = {
328
+ "supporting_data_files+": FileUpload(file_path, open(file_path, "rb")),
329
+ "tenant": tenant_id,
330
+ "modified_by": user_id,
331
+ }
332
+ upload_file = await client.environments.update(env_id, params)
333
+ return upload_file.data
334
+
335
+ try:
336
+ result = asyncio.run(_run())
337
+ format_output(result, ctx.obj["FORMAT"])
338
+ except Exception as e:
339
+ console.print(f"[red]Error uploading file:[/red] {str(e)}")
340
+ raise click.Abort()
341
+
342
+
343
+ @environments_group.command(
344
+ name="delete-all-files", help="Delete all files from an environment using ID"
345
+ )
346
+ @click.argument("env_id")
347
+ @click.pass_context
348
+ def delete_all_files(ctx, env_id):
349
+ """Delete all files from an environment"""
350
+
351
+ async def _run():
352
+ config, token, tenant_id, user_id = get_client_config(
353
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
354
+ )
355
+ client = TestZeusClient(**config)
356
+ async with client:
357
+ if token:
358
+ initialize_client_with_token(client, token)
359
+ else:
360
+ await client.ensure_authenticated()
361
+ await client.environments.update(
362
+ env_id,
363
+ {
364
+ "supporting_data_files": None,
365
+ "tenant": tenant_id,
366
+ "modified_by": user_id,
367
+ },
368
+ )
369
+ return {"id": env_id}
370
+
371
+ try:
372
+ result = asyncio.run(_run())
373
+ console.print(
374
+ f"[green]All files deleted from environment {result['id']}[/green]"
375
+ )
376
+ except Exception as e:
377
+ console.print(f"[red]Error deleting files:[/red] {str(e)}")
378
+ raise click.Abort()
379
+
380
+
381
+ @environments_group.command(
382
+ name="remove-file", help="Remove a file from an environment using ID and file path"
383
+ )
384
+ @click.argument("env_id")
385
+ @click.argument("file_path")
386
+ @click.pass_context
387
+ def remove_file(ctx, env_id, file_path):
388
+ """Remove a file from an environment"""
389
+
390
+ async def _run():
391
+ config, token, tenant_id, user_id = get_client_config(
392
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
393
+ )
394
+ client = TestZeusClient(**config)
395
+ async with client:
396
+ if token:
397
+ initialize_client_with_token(client, token)
398
+ else:
399
+ await client.ensure_authenticated()
400
+ env_data = await client.environments.get_one(env_id)
401
+ file_name = None
402
+ if env_data.supporting_data_files:
403
+ for file in env_data.supporting_data_files:
404
+ if (
405
+ file_path.split("/")[-1].split(".")[0].lower()
406
+ == file.split("_")[0].lower()
407
+ ):
408
+ file_name = file
409
+ break
410
+ params = {
411
+ "supporting_data_files-": [file_name],
412
+ "tenant": tenant_id,
413
+ "modified_by": user_id,
414
+ }
415
+ await client.environments.update(env_id, params)
416
+ return {"id": env_id}
417
+
418
+ try:
419
+ result = asyncio.run(_run())
420
+ console.print(f"[green]File removed from environment {result['id']}[/green]")
421
+ except Exception as e:
422
+ console.print(f"[red]Error removing file:[/red] {str(e)}")
423
+ raise click.Abort()
@@ -4,7 +4,6 @@ Tag management commands for TestZeus CLI.
4
4
 
5
5
  import asyncio
6
6
  import click
7
- import json
8
7
  from rich.console import Console
9
8
  from testzeus_sdk import TestZeusClient
10
9
  from testzeus_cli.config import get_client_config
@@ -38,7 +37,12 @@ def create(ctx, name, value):
38
37
  initialize_client_with_token(client, token)
39
38
  else:
40
39
  await client.ensure_authenticated()
41
- params = {"name": name, "value": value, "tenant": stored_tenant_id, "modified_by": stored_user_id}
40
+ params = {
41
+ "name": name,
42
+ "value": value,
43
+ "tenant": stored_tenant_id,
44
+ "modified_by": stored_user_id,
45
+ }
42
46
  tag = await client.tags.create(params)
43
47
  return tag.data
44
48
 
@@ -100,7 +104,7 @@ def get_tags(ctx, tag_id, expand):
100
104
  ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
101
105
  )
102
106
  client = TestZeusClient(**config)
103
-
107
+
104
108
  tag_id_validated = validate_id(tag_id, "tag")
105
109
  async with client:
106
110
  if token:
@@ -117,6 +121,7 @@ def get_tags(ctx, tag_id, expand):
117
121
  console.print(f"[red]Error getting tag: {str(e)}[/red]")
118
122
  raise click.Abort()
119
123
 
124
+
120
125
  @tags_group.command(name="update")
121
126
  @click.argument("tags_id")
122
127
  @click.option("--name", help="New tag name")
@@ -146,13 +151,14 @@ def update_tags(ctx, tags_id, name, value):
146
151
  if value:
147
152
  updates["value"] = value
148
153
  has_updates = True
149
-
154
+
150
155
  if has_updates:
151
156
  update_tags = await client.tags.update(tag_id_validated, updates)
152
157
  return update_tags.data
153
158
  else:
154
159
  console.print("[yellow]No updates provided[/yellow]")
155
160
  return None
161
+
156
162
  try:
157
163
  result = asyncio.run(_run())
158
164
  console.print(f"[green]Tag '{result['name']}' updated successfully[/green]")
@@ -4,7 +4,6 @@ Commands for managing test data in TestZeus CLI.
4
4
 
5
5
  import asyncio
6
6
  import click
7
- from typing import Dict, Any, Optional, List
8
7
  from rich.console import Console
9
8
  from pathlib import Path
10
9
 
@@ -17,6 +16,7 @@ from pocketbase.client import FileUpload
17
16
 
18
17
  console = Console()
19
18
 
19
+
20
20
  def _read_data_file(file_path: str) -> str:
21
21
  """
22
22
  Read data content from a file as plain text
@@ -38,6 +38,7 @@ def _read_data_file(file_path: str) -> str:
38
38
  # Always return the raw text content
39
39
  return content
40
40
 
41
+
41
42
  @click.group(name="test-data")
42
43
  def test_data_group():
43
44
  """Manage TestZeus test data"""
@@ -109,11 +110,21 @@ def get_test_data(ctx, test_data_id, expand):
109
110
  @test_data_group.command(name="create")
110
111
  @click.option("--name", required=True, help="Test data name")
111
112
  @click.option("--type", default="test", help="Test data type")
112
- @click.option("--status", default="draft", help="Test data status (draft, ready, deleted)")
113
+ @click.option(
114
+ "--status", default="draft", help="Test data status (draft, ready, deleted)"
115
+ )
113
116
  @click.option("--data", "-d", help="Test data content as text")
114
- @click.option("--data-file", "-df", type=click.Path(exists=True), help="Path to text file with test data")
115
117
  @click.option(
116
- "--file", "-f", type=click.Path(exists=True), help="Path to text file with test data"
118
+ "--data-file",
119
+ "-df",
120
+ type=click.Path(exists=True),
121
+ help="Path to text file with test data",
122
+ )
123
+ @click.option(
124
+ "--file",
125
+ "-f",
126
+ type=click.Path(exists=True),
127
+ help="Path to text file with test data",
117
128
  )
118
129
  @click.pass_context
119
130
  def create_test_data(ctx, name, type, status, data, data_file, file):
@@ -121,14 +132,13 @@ def create_test_data(ctx, name, type, status, data, data_file, file):
121
132
 
122
133
  if not data and not data_file:
123
134
  raise click.UsageError("Either --data or --data-file is required")
124
-
135
+
125
136
  if data and data_file:
126
137
  raise click.UsageError("Cannot use both --data and --data-file")
127
138
 
128
139
  # Process the data content (from file or directly)
129
140
  data_content = _read_data_file(data_file) if data_file else data
130
141
 
131
-
132
142
  async def _run():
133
143
  config, token, tenant_id, user_id = get_client_config(
134
144
  ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
@@ -136,7 +146,14 @@ def create_test_data(ctx, name, type, status, data, data_file, file):
136
146
  client = TestZeusClient(**config)
137
147
 
138
148
  # Prepare test data
139
- test_data = {"name": name, "type": type, "status": status, "data": data_content, "tenant": tenant_id, "modified_by": user_id}
149
+ test_data = {
150
+ "name": name,
151
+ "type": type,
152
+ "status": status,
153
+ "data": data_content,
154
+ "tenant": tenant_id,
155
+ "modified_by": user_id,
156
+ }
140
157
 
141
158
  # Add data content if provided directly
142
159
  if data:
@@ -173,9 +190,17 @@ def create_test_data(ctx, name, type, status, data, data_file, file):
173
190
  @click.option("--type", help="New test data type")
174
191
  @click.option("--status", help="New test data status (draft, ready, deleted)")
175
192
  @click.option("--data", "-d", help="New test data content as text")
176
- @click.option("--data-file", "-df", type=click.Path(exists=True), help="Path to text file with new test data")
177
193
  @click.option(
178
- "--file", "-f", type=click.Path(exists=True), help="Path to text file with new test data"
194
+ "--data-file",
195
+ "-df",
196
+ type=click.Path(exists=True),
197
+ help="Path to text file with new test data",
198
+ )
199
+ @click.option(
200
+ "--file",
201
+ "-f",
202
+ type=click.Path(exists=True),
203
+ help="Path to text file with new test data",
179
204
  )
180
205
  @click.pass_context
181
206
  def update_test_data(ctx, test_data_id, name, type, status, data, data_file, file):
@@ -190,7 +215,7 @@ def update_test_data(ctx, test_data_id, name, type, status, data, data_file, fil
190
215
  data_content = _read_data_file(data_file)
191
216
  elif data:
192
217
  data_content = data
193
-
218
+
194
219
  async def _run():
195
220
  config, token, tenant_id, user_id = get_client_config(
196
221
  ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
@@ -229,7 +254,9 @@ def update_test_data(ctx, test_data_id, name, type, status, data, data_file, fil
229
254
 
230
255
  if file:
231
256
  try:
232
- updates["supporting_data_files+"] = FileUpload(file, open(file, "rb"))
257
+ updates["supporting_data_files+"] = FileUpload(
258
+ file, open(file, "rb")
259
+ )
233
260
  has_updates = True
234
261
  except Exception as e:
235
262
  console.print(f"[red]Error reading file:[/red] {str(e)}")
@@ -243,7 +270,7 @@ def update_test_data(ctx, test_data_id, name, type, status, data, data_file, fil
243
270
  else:
244
271
  console.print("[yellow]No updates provided[/yellow]")
245
272
  return None
246
-
273
+
247
274
  try:
248
275
  result = asyncio.run(_run())
249
276
  format_output(result, ctx.obj["FORMAT"])
@@ -286,7 +313,10 @@ def delete_test_data(ctx, test_data_id):
286
313
  console.print(f"[red]Failed to delete test data:[/red] {str(e)}")
287
314
  exit(1)
288
315
 
289
- @test_data_group.command(name="upload-file", help="Upload a file to a test data using ID and file path")
316
+
317
+ @test_data_group.command(
318
+ name="upload-file", help="Upload a file to a test data using ID and file path"
319
+ )
290
320
  @click.argument("test_data_id")
291
321
  @click.argument("file_path")
292
322
  @click.pass_context
@@ -312,10 +342,13 @@ def upload_file(ctx, test_data_id, file_path):
312
342
  if not file_path_validated.exists():
313
343
  console.print(f"[red]File not found:[/red] {file_path}")
314
344
  exit(1)
315
- params = {"supporting_data_files+": FileUpload(file_path, open(file_path, "rb")), "tenant": tenant_id, "modified_by": user_id}
345
+ params = {
346
+ "supporting_data_files+": FileUpload(file_path, open(file_path, "rb")),
347
+ "tenant": tenant_id,
348
+ "modified_by": user_id,
349
+ }
316
350
  upload_file = await client.test_data.update(test_data_id_validated, params)
317
351
  return upload_file.data
318
-
319
352
 
320
353
  try:
321
354
  result = asyncio.run(_run())
@@ -324,7 +357,10 @@ def upload_file(ctx, test_data_id, file_path):
324
357
  console.print(f"[red]Error uploading file:[/red] {str(e)}")
325
358
  raise click.Abort()
326
359
 
327
- @test_data_group.command(name="delete-all-files", help="Delete all files from a test data using ID")
360
+
361
+ @test_data_group.command(
362
+ name="delete-all-files", help="Delete all files from a test data using ID"
363
+ )
328
364
  @click.argument("test_data_id")
329
365
  @click.pass_context
330
366
  def delete_all_files(ctx, test_data_id):
@@ -344,8 +380,14 @@ def delete_all_files(ctx, test_data_id):
344
380
  initialize_client_with_token(client, token)
345
381
  else:
346
382
  await client.ensure_authenticated()
347
- params = {"supporting_data_files": None, "tenant": tenant_id, "modified_by": user_id}
348
- update_test_data = await client.test_data.update(test_data_id_validated, params)
383
+ params = {
384
+ "supporting_data_files": None,
385
+ "tenant": tenant_id,
386
+ "modified_by": user_id,
387
+ }
388
+ update_test_data = await client.test_data.update(
389
+ test_data_id_validated, params
390
+ )
349
391
  return update_test_data.data
350
392
 
351
393
  try:
@@ -353,4 +395,49 @@ def delete_all_files(ctx, test_data_id):
353
395
  format_output(result, ctx.obj["FORMAT"])
354
396
  except Exception as e:
355
397
  console.print(f"[red]Error deleting all files:[/red] {str(e)}")
356
- raise click.Abort()
398
+ raise click.Abort()
399
+
400
+
401
+ @test_data_group.command(
402
+ name="remove-file", help="Remove a file from a test data using ID and file path"
403
+ )
404
+ @click.argument("test_data_id")
405
+ @click.argument("file_path")
406
+ @click.pass_context
407
+ def remove_file(ctx, test_data_id, file_path):
408
+ """Remove a file from a test data"""
409
+
410
+ async def _run():
411
+ config, token, tenant_id, user_id = get_client_config(
412
+ ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL")
413
+ )
414
+ client = TestZeusClient(**config)
415
+ async with client:
416
+ if token:
417
+ initialize_client_with_token(client, token)
418
+ else:
419
+ await client.ensure_authenticated()
420
+ test_data_data = await client.test_data.get_one(test_data_id)
421
+ file_name = None
422
+ if test_data_data.supporting_data_files:
423
+ for file in test_data_data.supporting_data_files:
424
+ if (
425
+ file_path.split("/")[-1].split(".")[0].lower()
426
+ == file.split("_")[0].lower()
427
+ ):
428
+ file_name = file
429
+ break
430
+ params = {
431
+ "supporting_data_files-": [file_name],
432
+ "tenant": tenant_id,
433
+ "modified_by": user_id,
434
+ }
435
+ await client.test_data.update(test_data_id, params)
436
+ return {"id": test_data_id}
437
+
438
+ try:
439
+ result = asyncio.run(_run())
440
+ console.print(f"[green]File removed from test data {result['id']}[/green]")
441
+ except Exception as e:
442
+ console.print(f"[red]Error removing file:[/red] {str(e)}")
443
+ raise click.Abort()
@@ -51,7 +51,12 @@ def create_test_run(ctx, name, test, env, tag):
51
51
  unique_name = f"{name}-{timestamp}-test-run"
52
52
 
53
53
  # Create base parameters
54
- params = {"name": unique_name, "test": test, "tenant": stored_tenant_id, "modified_by": stored_user_id}
54
+ params = {
55
+ "name": unique_name,
56
+ "test": test,
57
+ "tenant": stored_tenant_id,
58
+ "modified_by": stored_user_id,
59
+ }
55
60
 
56
61
  if env:
57
62
  params["environment"] = env
@@ -191,7 +196,11 @@ def cancel_test_run(ctx, test_run_id):
191
196
  await client.ensure_authenticated()
192
197
 
193
198
  # Only include modified_by if user_id is not empty
194
- params = {"id_or_name": test_run_id_validated, "tenant":stored_tenant_id, "modified_by":stored_user_id}
199
+ params = {
200
+ "id_or_name": test_run_id_validated,
201
+ "tenant": stored_tenant_id,
202
+ "modified_by": stored_user_id,
203
+ }
195
204
 
196
205
  if ctx.obj.get("VERBOSE"):
197
206
  console.print(
@@ -267,7 +276,12 @@ def watch_test_run(ctx, test_run_id, interval):
267
276
 
268
277
  try:
269
278
  result = asyncio.run(_monitor_test_run())
270
- duration = datetime.fromisoformat(result['end_time'].replace("Z", "+00:00")) - datetime.fromisoformat(result['start_time'].replace("Z", "+00:00")) if 'end_time' in result and 'start_time' in result else None
279
+ duration = (
280
+ datetime.fromisoformat(result["end_time"].replace("Z", "+00:00"))
281
+ - datetime.fromisoformat(result["start_time"].replace("Z", "+00:00"))
282
+ if "end_time" in result and "start_time" in result
283
+ else None
284
+ )
271
285
  console.print(f"Test run duration: {duration.total_seconds()} seconds")
272
286
  format_output(result, ctx.obj["FORMAT"])
273
287
  except Exception as e:
@@ -325,7 +339,7 @@ def download_attachments(ctx, test_run_id, output_dir):
325
339
  console.print(f"- {attachment}")
326
340
  except Exception as e:
327
341
  if ctx.obj.get("VERBOSE"):
328
- console.print(f"[red]Failed to download attachments:[/red]")
342
+ console.print("[red]Failed to download attachments:[/red]")
329
343
  import traceback
330
344
 
331
345
  console.print(traceback.format_exc())
@@ -16,6 +16,7 @@ from testzeus_cli.utils.auth import initialize_client_with_token
16
16
 
17
17
  console = Console()
18
18
 
19
+
19
20
  @click.group(name="tests")
20
21
  def tests_group():
21
22
  """Manage TestZeus tests"""
@@ -107,9 +108,13 @@ def _read_feature_file(file_path: str) -> str:
107
108
  @click.option("--data", multiple=True, help="Test data IDs")
108
109
  @click.option("--tags", multiple=True, help="Tag IDs")
109
110
  @click.option("--environment", help="Environment ID")
110
- @click.option("--execution-mode", default="lenient", help="Execution mode (lenient, strict)")
111
+ @click.option(
112
+ "--execution-mode", default="lenient", help="Execution mode (lenient, strict)"
113
+ )
111
114
  @click.pass_context
112
- def create_test(ctx, name, feature, feature_file, status, data, tags, environment, execution_mode):
115
+ def create_test(
116
+ ctx, name, feature, feature_file, status, data, tags, environment, execution_mode
117
+ ):
113
118
  """Create a new test with feature content from text or file"""
114
119
 
115
120
  if not feature and not feature_file:
@@ -128,7 +133,13 @@ def create_test(ctx, name, feature, feature_file, status, data, tags, environmen
128
133
  client = TestZeusClient(**config)
129
134
 
130
135
  # Prepare parameters
131
- test_data = {"name": name, "status": status, "execution_mode": execution_mode, "tenant": stored_tenant_id, "modified_by": stored_user_id}
136
+ test_data = {
137
+ "name": name,
138
+ "status": status,
139
+ "execution_mode": execution_mode,
140
+ "tenant": stored_tenant_id,
141
+ "modified_by": stored_user_id,
142
+ }
132
143
 
133
144
  # Always set feature content as text
134
145
  test_data["test_feature"] = feature_content
@@ -251,7 +262,7 @@ def update_test(
251
262
  format_output(result, ctx.obj["FORMAT"])
252
263
  except Exception as e:
253
264
  if ctx.obj.get("VERBOSE"):
254
- console.print(f"[red]Error updating test:[/red]")
265
+ console.print("[red]Error updating test:[/red]")
255
266
  import traceback
256
267
 
257
268
  console.print(traceback.format_exc())
@@ -2,7 +2,6 @@
2
2
  Configuration management for TestZeus CLI.
3
3
  """
4
4
 
5
- import os
6
5
  from pathlib import Path
7
6
  from typing import Dict, Any, Optional, Tuple
8
7
 
@@ -0,0 +1,3 @@
1
+ """
2
+ Utility modules for TestZeus CLI.
3
+ """
@@ -3,7 +3,7 @@ Client utility functions for TestZeus CLI.
3
3
  """
4
4
 
5
5
  import asyncio
6
- from typing import Dict, Any, Optional, Callable, TypeVar, Awaitable, cast, Dict
6
+ from typing import Any, Optional, Callable, TypeVar, Awaitable, Dict
7
7
 
8
8
  from testzeus_sdk import TestZeusClient
9
9
  from testzeus_cli.config import get_client_config
@@ -33,7 +33,6 @@ 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
-
37
36
  if isinstance(data, dict):
38
37
  format_dict_as_table(data)
39
38
  elif isinstance(data, list):
@@ -112,7 +111,8 @@ def format_value_for_display(value: Any) -> str:
112
111
  if len(json_str) > 50 and not (isinstance(value, dict) and "id" in value):
113
112
  return f"{json_str[:50]}..."
114
113
  return json_str
115
- except:
114
+ except Exception as e:
115
+ print(f"Error formatting value for display: {e}")
116
116
  return str(value)
117
117
 
118
118
  # Default string representation
@@ -2,7 +2,7 @@
2
2
  Input validation utilities for TestZeus CLI.
3
3
  """
4
4
 
5
- from typing import Any, Dict, List, Optional, Union, TypeVar, Callable
5
+ from typing import Dict, List, Optional, TypeVar
6
6
 
7
7
  T = TypeVar("T")
8
8
 
@@ -40,8 +40,15 @@ def validate_id(id_value: str, entity_type: str = "entity") -> str:
40
40
  Raises:
41
41
  ValueError: If the ID is invalid
42
42
  """
43
- if not id_value or not isinstance(id_value, str) or len(id_value) != 15 or not id_value.isalnum():
44
- raise ValueError(f"Invalid {entity_type} ID: must be 15 alphanumeric characters")
43
+ if (
44
+ not id_value
45
+ or not isinstance(id_value, str)
46
+ or len(id_value) != 15
47
+ or not id_value.isalnum()
48
+ ):
49
+ raise ValueError(
50
+ f"Invalid {entity_type} ID: must be 15 alphanumeric characters"
51
+ )
45
52
  return id_value.strip()
46
53
 
47
54
 
@@ -1,7 +0,0 @@
1
- """
2
- Utility modules for TestZeus CLI.
3
- """
4
-
5
- from testzeus_cli.utils.formatters import format_output
6
- from testzeus_cli.utils.validators import validate_id, parse_key_value_pairs
7
- from testzeus_cli.utils.client import run_client_operation, with_authenticated_client
File without changes