pygeai 0.5.0__py3-none-any.whl → 0.6.0b3__py3-none-any.whl
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.
- pygeai/__init__.py +1 -1
- pygeai/auth/__init__.py +0 -0
- pygeai/auth/clients.py +55 -0
- pygeai/auth/endpoints.py +2 -0
- pygeai/cli/__init__.py +0 -1
- pygeai/cli/commands/auth.py +123 -0
- pygeai/cli/commands/base.py +22 -1
- pygeai/cli/commands/docs.py +105 -0
- pygeai/cli/texts/help.py +157 -24
- pygeai/core/files/responses.py +4 -3
- pygeai/lab/clients.py +3 -3
- pygeai/lab/tools/clients.py +4 -4
- pygeai/tests/admin/test_clients.py +143 -0
- pygeai/tests/auth/__init__.py +0 -0
- pygeai/tests/auth/test_clients.py +105 -0
- pygeai/tests/cli/commands/lab/test_ai_lab.py +41 -35
- pygeai/tests/cli/commands/lab/test_spec.py +24 -56
- pygeai/tests/cli/commands/test_chat.py +21 -3
- pygeai/tests/cli/commands/test_evaluation.py +649 -0
- pygeai/tests/cli/commands/test_secrets.py +171 -0
- pygeai/tests/core/base/data/models.py +7 -0
- pygeai/tests/core/base/test_mappers.py +43 -11
- pygeai/tests/core/base/test_models.py +3 -1
- pygeai/tests/core/base/test_responses.py +53 -0
- pygeai/tests/core/common/test_config.py +2 -3
- pygeai/tests/core/files/test_mappers.py +137 -0
- pygeai/tests/core/plugins/__init__.py +0 -0
- pygeai/tests/core/plugins/test_clients.py +64 -0
- pygeai/tests/evaluation/__init__.py +0 -0
- pygeai/tests/evaluation/dataset/__init__.py +0 -0
- pygeai/tests/evaluation/dataset/test_clients.py +263 -0
- pygeai/tests/evaluation/plan/__init__.py +0 -0
- pygeai/tests/evaluation/plan/test_clients.py +193 -0
- pygeai/tests/evaluation/result/__init__.py +0 -0
- pygeai/tests/evaluation/result/test_clients.py +64 -0
- pygeai/tests/integration/assistants/rag/test_create_rag.py +1 -1
- pygeai/tests/integration/chat/test_generate_image.py +1 -1
- pygeai/tests/integration/lab/agents/test_agents_list.py +1 -1
- pygeai/tests/integration/lab/agents/test_create_agent.py +3 -3
- pygeai/tests/integration/lab/agents/test_create_sharing_link.py +1 -1
- pygeai/tests/integration/lab/agents/test_delete_agent.py +2 -2
- pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
- pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +2 -2
- pygeai/tests/integration/lab/agents/test_update_agent.py +3 -3
- pygeai/tests/integration/lab/processes/test_create_process.py +1 -1
- pygeai/tests/integration/lab/processes/test_create_task.py +211 -0
- pygeai/tests/integration/lab/processes/test_delete_process.py +111 -0
- pygeai/tests/integration/lab/processes/test_get_process.py +1 -1
- pygeai/tests/integration/lab/processes/test_list_process_instances.py +91 -0
- pygeai/tests/integration/lab/processes/test_list_processes.py +138 -0
- pygeai/tests/integration/lab/processes/test_publish_process_revision.py +232 -0
- pygeai/tests/integration/lab/processes/test_update_process.py +1 -1
- pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +1 -1
- pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +1 -1
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +1 -1
- pygeai/tests/integration/lab/tools/test_create_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_delete_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_get_parameter.py +1 -1
- pygeai/tests/integration/lab/tools/test_get_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
- pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +1 -1
- pygeai/tests/integration/lab/tools/test_set_parameter.py +1 -1
- pygeai/tests/integration/lab/tools/test_update_tool.py +1 -1
- pygeai/tests/lab/agents/test_clients.py +17 -34
- pygeai/tests/lab/processes/test_clients.py +30 -93
- pygeai/tests/lab/processes/test_mappers.py +12 -71
- pygeai/tests/lab/strategies/test_clients.py +63 -63
- pygeai/tests/lab/test_managers.py +3 -6
- pygeai/tests/lab/test_models.py +9 -8
- pygeai/tests/lab/tools/test_clients.py +22 -45
- pygeai/tests/migration/test_strategies.py +16 -16
- pygeai/tests/organization/test_mappers.py +11 -4
- pygeai/tests/organization/test_responses.py +137 -0
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/METADATA +1 -1
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/RECORD +79 -53
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/WHEEL +0 -0
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/entry_points.txt +0 -0
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/top_level.txt +0 -0
|
@@ -17,8 +17,8 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
def setUp(self):
|
|
20
|
-
self.client = AgenticProcessClient()
|
|
21
20
|
self.project_id = "test-project-id"
|
|
21
|
+
self.client = AgenticProcessClient(api_key="test_key", base_url="https://test.url", project_id=self.project_id)
|
|
22
22
|
self.process_id = "test-process-id"
|
|
23
23
|
self.process_name = "test-process-name"
|
|
24
24
|
self.task_id = "test-task-id"
|
|
@@ -37,7 +37,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
37
37
|
mock_response.json.return_value = expected_response
|
|
38
38
|
|
|
39
39
|
result = self.client.create_process(
|
|
40
|
-
project_id=self.project_id,
|
|
41
40
|
key="test-key",
|
|
42
41
|
name="Test Process",
|
|
43
42
|
description="Test Description",
|
|
@@ -82,7 +81,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
82
81
|
|
|
83
82
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
84
83
|
self.client.create_process(
|
|
85
|
-
project_id=self.project_id,
|
|
86
84
|
key="test-key",
|
|
87
85
|
name="Test Process"
|
|
88
86
|
)
|
|
@@ -106,7 +104,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
result = self.client.update_process(
|
|
109
|
-
project_id=self.project_id,
|
|
110
107
|
process_id=self.process_id,
|
|
111
108
|
name="Updated Process",
|
|
112
109
|
description="Updated Description",
|
|
@@ -143,7 +140,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
143
140
|
}
|
|
144
141
|
|
|
145
142
|
result = self.client.update_process(
|
|
146
|
-
project_id=self.project_id,
|
|
147
143
|
name=self.process_name,
|
|
148
144
|
key="updated-key",
|
|
149
145
|
description="Updated Description",
|
|
@@ -166,7 +162,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
166
162
|
mock_response.json.return_value = expected_response
|
|
167
163
|
|
|
168
164
|
result = self.client.update_process(
|
|
169
|
-
project_id=self.project_id,
|
|
170
165
|
process_id=self.process_id,
|
|
171
166
|
name="Upserted Process",
|
|
172
167
|
upsert=True
|
|
@@ -181,7 +176,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
181
176
|
|
|
182
177
|
def test_update_process_missing_identifier(self):
|
|
183
178
|
with self.assertRaises(ValueError) as context:
|
|
184
|
-
self.client.update_process(
|
|
179
|
+
self.client.update_process()
|
|
185
180
|
self.assertEqual(str(context.exception), "Either process_id or name must be provided.")
|
|
186
181
|
|
|
187
182
|
@patch("pygeai.core.services.rest.ApiService.put")
|
|
@@ -202,7 +197,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
202
197
|
|
|
203
198
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
204
199
|
self.client.update_process(
|
|
205
|
-
project_id=self.project_id,
|
|
206
200
|
process_id=self.process_id,
|
|
207
201
|
name="Updated Process"
|
|
208
202
|
)
|
|
@@ -219,7 +213,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
219
213
|
mock_response.json.return_value = expected_response
|
|
220
214
|
|
|
221
215
|
result = self.client.get_process(
|
|
222
|
-
project_id=self.project_id,
|
|
223
216
|
process_id=self.process_id,
|
|
224
217
|
revision="0",
|
|
225
218
|
version=0,
|
|
@@ -246,7 +239,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
246
239
|
mock_response.json.return_value = expected_response
|
|
247
240
|
|
|
248
241
|
result = self.client.get_process(
|
|
249
|
-
project_id=self.project_id,
|
|
250
242
|
process_name=self.process_name
|
|
251
243
|
)
|
|
252
244
|
|
|
@@ -259,7 +251,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
259
251
|
|
|
260
252
|
def test_get_process_missing_identifier(self):
|
|
261
253
|
with self.assertRaises(ValueError) as context:
|
|
262
|
-
self.client.get_process(
|
|
254
|
+
self.client.get_process()
|
|
263
255
|
self.assertEqual(str(context.exception), "Either process_id or process_name must be provided.")
|
|
264
256
|
|
|
265
257
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -271,7 +263,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
271
263
|
|
|
272
264
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
273
265
|
self.client.get_process(
|
|
274
|
-
project_id=self.project_id,
|
|
275
266
|
process_id=self.process_id
|
|
276
267
|
)
|
|
277
268
|
|
|
@@ -285,7 +276,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
285
276
|
mock_response.json.return_value = expected_response
|
|
286
277
|
|
|
287
278
|
result = self.client.list_processes(
|
|
288
|
-
project_id=self.project_id,
|
|
289
279
|
id="process-1",
|
|
290
280
|
name="Process1",
|
|
291
281
|
status="active",
|
|
@@ -318,7 +308,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
318
308
|
mock_response.text = "Invalid JSON response"
|
|
319
309
|
|
|
320
310
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
321
|
-
self.client.list_processes(
|
|
311
|
+
self.client.list_processes()
|
|
322
312
|
|
|
323
313
|
self.assertEqual(str(context.exception), f"Unable to list processes for project {self.project_id}: Invalid JSON response")
|
|
324
314
|
mock_get.assert_called_once()
|
|
@@ -330,7 +320,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
330
320
|
mock_response.json.return_value = expected_response
|
|
331
321
|
|
|
332
322
|
result = self.client.list_process_instances(
|
|
333
|
-
project_id=self.project_id,
|
|
334
323
|
process_id=self.process_id,
|
|
335
324
|
is_active=True,
|
|
336
325
|
start="0",
|
|
@@ -352,7 +341,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
352
341
|
|
|
353
342
|
def test_list_process_instances_missing_process_id(self):
|
|
354
343
|
with self.assertRaises(ValueError) as context:
|
|
355
|
-
self.client.list_process_instances(
|
|
344
|
+
self.client.list_process_instances(process_id="")
|
|
356
345
|
self.assertEqual(str(context.exception), "Process ID must be provided.")
|
|
357
346
|
|
|
358
347
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -364,7 +353,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
364
353
|
|
|
365
354
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
366
355
|
self.client.list_process_instances(
|
|
367
|
-
project_id=self.project_id,
|
|
368
356
|
process_id=self.process_id
|
|
369
357
|
)
|
|
370
358
|
|
|
@@ -373,12 +361,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
373
361
|
|
|
374
362
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
375
363
|
def test_delete_process_success_with_id(self, mock_delete):
|
|
376
|
-
expected_response = {
|
|
364
|
+
expected_response = {}
|
|
377
365
|
mock_response = mock_delete.return_value
|
|
378
|
-
mock_response.
|
|
366
|
+
mock_response.status_code = 204
|
|
379
367
|
|
|
380
368
|
result = self.client.delete_process(
|
|
381
|
-
project_id=self.project_id,
|
|
382
369
|
process_id=self.process_id
|
|
383
370
|
)
|
|
384
371
|
|
|
@@ -392,12 +379,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
392
379
|
|
|
393
380
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
394
381
|
def test_delete_process_success_with_name(self, mock_delete):
|
|
395
|
-
expected_response = {
|
|
382
|
+
expected_response = {}
|
|
396
383
|
mock_response = mock_delete.return_value
|
|
397
|
-
mock_response.
|
|
384
|
+
mock_response.status_code = 204
|
|
398
385
|
|
|
399
386
|
result = self.client.delete_process(
|
|
400
|
-
project_id=self.project_id,
|
|
401
387
|
process_name=self.process_name
|
|
402
388
|
)
|
|
403
389
|
|
|
@@ -409,7 +395,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
409
395
|
|
|
410
396
|
def test_delete_process_missing_identifier(self):
|
|
411
397
|
with self.assertRaises(ValueError) as context:
|
|
412
|
-
self.client.delete_process(
|
|
398
|
+
self.client.delete_process()
|
|
413
399
|
self.assertEqual(str(context.exception), "Either process_id or process_name must be provided.")
|
|
414
400
|
|
|
415
401
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
@@ -421,7 +407,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
421
407
|
|
|
422
408
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
423
409
|
self.client.delete_process(
|
|
424
|
-
project_id=self.project_id,
|
|
425
410
|
process_id=self.process_id
|
|
426
411
|
)
|
|
427
412
|
|
|
@@ -435,7 +420,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
435
420
|
mock_response.json.return_value = expected_response
|
|
436
421
|
|
|
437
422
|
result = self.client.publish_process_revision(
|
|
438
|
-
project_id=self.project_id,
|
|
439
423
|
process_id=self.process_id,
|
|
440
424
|
revision=self.revision
|
|
441
425
|
)
|
|
@@ -456,7 +440,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
456
440
|
mock_response.json.return_value = expected_response
|
|
457
441
|
|
|
458
442
|
result = self.client.publish_process_revision(
|
|
459
|
-
project_id=self.project_id,
|
|
460
443
|
process_name=self.process_name,
|
|
461
444
|
revision=self.revision
|
|
462
445
|
)
|
|
@@ -471,7 +454,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
471
454
|
def test_publish_process_revision_missing_identifier(self):
|
|
472
455
|
with self.assertRaises(ValueError) as context:
|
|
473
456
|
self.client.publish_process_revision(
|
|
474
|
-
project_id=self.project_id,
|
|
475
457
|
revision=self.revision
|
|
476
458
|
)
|
|
477
459
|
self.assertEqual(str(context.exception), "Either process_id or process_name must be provided.")
|
|
@@ -479,7 +461,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
479
461
|
def test_publish_process_revision_missing_revision(self):
|
|
480
462
|
with self.assertRaises(ValueError) as context:
|
|
481
463
|
self.client.publish_process_revision(
|
|
482
|
-
project_id=self.project_id,
|
|
483
464
|
process_id=self.process_id
|
|
484
465
|
)
|
|
485
466
|
self.assertEqual(str(context.exception), "Revision must be provided.")
|
|
@@ -493,7 +474,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
493
474
|
|
|
494
475
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
495
476
|
self.client.publish_process_revision(
|
|
496
|
-
project_id=self.project_id,
|
|
497
477
|
process_id=self.process_id,
|
|
498
478
|
revision=self.revision
|
|
499
479
|
)
|
|
@@ -508,7 +488,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
508
488
|
mock_response.json.return_value = expected_response
|
|
509
489
|
|
|
510
490
|
result = self.client.create_task(
|
|
511
|
-
project_id=self.project_id,
|
|
512
491
|
name="Test Task",
|
|
513
492
|
description="Task Description",
|
|
514
493
|
title_template="Task for {{issue}}",
|
|
@@ -543,7 +522,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
543
522
|
|
|
544
523
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
545
524
|
self.client.create_task(
|
|
546
|
-
project_id=self.project_id,
|
|
547
525
|
name="Test Task"
|
|
548
526
|
)
|
|
549
527
|
|
|
@@ -557,7 +535,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
557
535
|
mock_response.json.return_value = expected_response
|
|
558
536
|
|
|
559
537
|
result = self.client.get_task(
|
|
560
|
-
project_id=self.project_id,
|
|
561
538
|
task_id=self.task_id
|
|
562
539
|
)
|
|
563
540
|
|
|
@@ -576,7 +553,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
576
553
|
mock_response.json.return_value = expected_response
|
|
577
554
|
|
|
578
555
|
result = self.client.get_task(
|
|
579
|
-
project_id=self.project_id,
|
|
580
556
|
task_id=self.task_id,
|
|
581
557
|
task_name=self.task_name
|
|
582
558
|
)
|
|
@@ -589,7 +565,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
589
565
|
|
|
590
566
|
def test_get_task_missing_identifier(self):
|
|
591
567
|
with self.assertRaises(ValueError) as context:
|
|
592
|
-
self.client.get_task(
|
|
568
|
+
self.client.get_task(task_id="", task_name="")
|
|
593
569
|
self.assertEqual(str(context.exception), "Either task_id or task_name must be provided.")
|
|
594
570
|
|
|
595
571
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -601,7 +577,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
601
577
|
|
|
602
578
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
603
579
|
self.client.get_task(
|
|
604
|
-
project_id=self.project_id,
|
|
605
580
|
task_id=self.task_id
|
|
606
581
|
)
|
|
607
582
|
|
|
@@ -615,7 +590,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
615
590
|
mock_response.json.return_value = expected_response
|
|
616
591
|
|
|
617
592
|
result = self.client.list_tasks(
|
|
618
|
-
project_id=self.project_id,
|
|
619
593
|
id="task-1",
|
|
620
594
|
start="0",
|
|
621
595
|
count="10",
|
|
@@ -644,7 +618,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
644
618
|
mock_response.text = "Invalid JSON response"
|
|
645
619
|
|
|
646
620
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
647
|
-
self.client.list_tasks(
|
|
621
|
+
self.client.list_tasks()
|
|
648
622
|
|
|
649
623
|
self.assertEqual(str(context.exception), f"Unable to list tasks for project {self.project_id}: Invalid JSON response")
|
|
650
624
|
mock_get.assert_called_once()
|
|
@@ -656,7 +630,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
656
630
|
mock_response.json.return_value = expected_response
|
|
657
631
|
|
|
658
632
|
result = self.client.update_task(
|
|
659
|
-
project_id=self.project_id,
|
|
660
633
|
task_id=self.task_id,
|
|
661
634
|
name="Updated Task",
|
|
662
635
|
description="Updated Description",
|
|
@@ -689,7 +662,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
689
662
|
mock_response.json.return_value = expected_response
|
|
690
663
|
|
|
691
664
|
result = self.client.update_task(
|
|
692
|
-
project_id=self.project_id,
|
|
693
665
|
task_id=self.task_id,
|
|
694
666
|
name="Upserted Task",
|
|
695
667
|
upsert=True
|
|
@@ -704,7 +676,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
704
676
|
|
|
705
677
|
def test_update_task_missing_task_id(self):
|
|
706
678
|
with self.assertRaises(ValueError) as context:
|
|
707
|
-
self.client.update_task(
|
|
679
|
+
self.client.update_task(task_id="")
|
|
708
680
|
self.assertEqual(str(context.exception), "Task ID must be provided.")
|
|
709
681
|
|
|
710
682
|
@patch("pygeai.core.services.rest.ApiService.put")
|
|
@@ -716,7 +688,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
716
688
|
|
|
717
689
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
718
690
|
self.client.update_task(
|
|
719
|
-
project_id=self.project_id,
|
|
720
691
|
task_id=self.task_id,
|
|
721
692
|
name="Updated Task"
|
|
722
693
|
)
|
|
@@ -726,12 +697,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
726
697
|
|
|
727
698
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
728
699
|
def test_delete_task_success_with_id(self, mock_delete):
|
|
729
|
-
expected_response = {
|
|
700
|
+
expected_response = {}
|
|
730
701
|
mock_response = mock_delete.return_value
|
|
731
|
-
mock_response.
|
|
702
|
+
mock_response.status_code = 204
|
|
732
703
|
|
|
733
704
|
result = self.client.delete_task(
|
|
734
|
-
project_id=self.project_id,
|
|
735
705
|
task_id=self.task_id
|
|
736
706
|
)
|
|
737
707
|
|
|
@@ -745,12 +715,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
745
715
|
|
|
746
716
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
747
717
|
def test_delete_task_success_with_name(self, mock_delete):
|
|
748
|
-
expected_response = {
|
|
718
|
+
expected_response = {}
|
|
749
719
|
mock_response = mock_delete.return_value
|
|
750
|
-
mock_response.
|
|
720
|
+
mock_response.status_code = 204
|
|
751
721
|
|
|
752
722
|
result = self.client.delete_task(
|
|
753
|
-
project_id=self.project_id,
|
|
754
723
|
task_id=self.task_id,
|
|
755
724
|
task_name=self.task_name
|
|
756
725
|
)
|
|
@@ -763,7 +732,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
763
732
|
|
|
764
733
|
def test_delete_task_missing_identifier(self):
|
|
765
734
|
with self.assertRaises(ValueError) as context:
|
|
766
|
-
self.client.delete_task(
|
|
735
|
+
self.client.delete_task(task_id="", task_name="")
|
|
767
736
|
self.assertEqual(str(context.exception), "Either task_id or task_name must be provided.")
|
|
768
737
|
|
|
769
738
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
@@ -775,7 +744,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
775
744
|
|
|
776
745
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
777
746
|
self.client.delete_task(
|
|
778
|
-
project_id=self.project_id,
|
|
779
747
|
task_id=self.task_id
|
|
780
748
|
)
|
|
781
749
|
|
|
@@ -789,7 +757,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
789
757
|
mock_response.json.return_value = expected_response
|
|
790
758
|
|
|
791
759
|
result = self.client.publish_task_revision(
|
|
792
|
-
project_id=self.project_id,
|
|
793
760
|
task_id=self.task_id,
|
|
794
761
|
revision=self.revision
|
|
795
762
|
)
|
|
@@ -810,7 +777,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
810
777
|
mock_response.json.return_value = expected_response
|
|
811
778
|
|
|
812
779
|
result = self.client.publish_task_revision(
|
|
813
|
-
project_id=self.project_id,
|
|
814
780
|
task_id=self.task_id,
|
|
815
781
|
task_name=self.task_name,
|
|
816
782
|
revision=self.revision
|
|
@@ -826,7 +792,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
826
792
|
def test_publish_task_revision_missing_identifier(self):
|
|
827
793
|
with self.assertRaises(ValueError) as context:
|
|
828
794
|
self.client.publish_task_revision(
|
|
829
|
-
project_id=self.project_id,
|
|
830
795
|
task_id="",
|
|
831
796
|
task_name="",
|
|
832
797
|
revision=self.revision
|
|
@@ -836,7 +801,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
836
801
|
def test_publish_task_revision_missing_revision(self):
|
|
837
802
|
with self.assertRaises(ValueError) as context:
|
|
838
803
|
self.client.publish_task_revision(
|
|
839
|
-
project_id=self.project_id,
|
|
840
804
|
task_id=self.task_id
|
|
841
805
|
)
|
|
842
806
|
self.assertEqual(str(context.exception), "Revision must be provided.")
|
|
@@ -850,7 +814,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
850
814
|
|
|
851
815
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
852
816
|
self.client.publish_task_revision(
|
|
853
|
-
project_id=self.project_id,
|
|
854
817
|
task_id=self.task_id,
|
|
855
818
|
revision=self.revision
|
|
856
819
|
)
|
|
@@ -865,7 +828,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
865
828
|
mock_response.json.return_value = expected_response
|
|
866
829
|
|
|
867
830
|
result = self.client.start_instance(
|
|
868
|
-
project_id=self.project_id,
|
|
869
831
|
process_name=self.process_name,
|
|
870
832
|
subject="Test Subject",
|
|
871
833
|
variables=[{"key": "location", "value": "Paris"}]
|
|
@@ -893,7 +855,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
893
855
|
|
|
894
856
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
895
857
|
self.client.start_instance(
|
|
896
|
-
project_id=self.project_id,
|
|
897
858
|
process_name=self.process_name
|
|
898
859
|
)
|
|
899
860
|
|
|
@@ -907,7 +868,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
907
868
|
mock_response.json.return_value = expected_response
|
|
908
869
|
|
|
909
870
|
result = self.client.abort_instance(
|
|
910
|
-
project_id=self.project_id,
|
|
911
871
|
instance_id=self.instance_id
|
|
912
872
|
)
|
|
913
873
|
|
|
@@ -922,7 +882,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
922
882
|
|
|
923
883
|
def test_abort_instance_missing_id(self):
|
|
924
884
|
with self.assertRaises(ValueError) as context:
|
|
925
|
-
self.client.abort_instance(
|
|
885
|
+
self.client.abort_instance(instance_id="")
|
|
926
886
|
self.assertEqual(str(context.exception), "Instance ID must be provided.")
|
|
927
887
|
|
|
928
888
|
@patch("pygeai.core.services.rest.ApiService.post")
|
|
@@ -934,7 +894,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
934
894
|
|
|
935
895
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
936
896
|
self.client.abort_instance(
|
|
937
|
-
project_id=self.project_id,
|
|
938
897
|
instance_id=self.instance_id
|
|
939
898
|
)
|
|
940
899
|
|
|
@@ -943,7 +902,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
943
902
|
|
|
944
903
|
def test_get_instance_missing_id(self):
|
|
945
904
|
with self.assertRaises(ValueError) as context:
|
|
946
|
-
self.client.get_instance(
|
|
905
|
+
self.client.get_instance(instance_id="")
|
|
947
906
|
self.assertEqual(str(context.exception), "Instance ID must be provided.")
|
|
948
907
|
|
|
949
908
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -955,7 +914,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
955
914
|
|
|
956
915
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
957
916
|
self.client.get_instance(
|
|
958
|
-
project_id=self.project_id,
|
|
959
917
|
instance_id=self.instance_id
|
|
960
918
|
)
|
|
961
919
|
|
|
@@ -970,7 +928,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
970
928
|
mock_response.json.return_value = expected_response
|
|
971
929
|
|
|
972
930
|
result = self.client.get_instance_history(
|
|
973
|
-
project_id=self.project_id,
|
|
974
931
|
instance_id=self.instance_id
|
|
975
932
|
)
|
|
976
933
|
|
|
@@ -984,7 +941,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
984
941
|
|
|
985
942
|
def test_get_instance_history_missing_id(self):
|
|
986
943
|
with self.assertRaises(ValueError) as context:
|
|
987
|
-
self.client.get_instance_history(
|
|
944
|
+
self.client.get_instance_history(instance_id="")
|
|
988
945
|
self.assertEqual(str(context.exception), "Instance ID must be provided.")
|
|
989
946
|
|
|
990
947
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -996,7 +953,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
996
953
|
|
|
997
954
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
998
955
|
self.client.get_instance_history(
|
|
999
|
-
project_id=self.project_id,
|
|
1000
956
|
instance_id=self.instance_id
|
|
1001
957
|
)
|
|
1002
958
|
|
|
@@ -1011,7 +967,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1011
967
|
mock_response.json.return_value = expected_response
|
|
1012
968
|
|
|
1013
969
|
result = self.client.get_thread_information(
|
|
1014
|
-
project_id=self.project_id,
|
|
1015
970
|
thread_id=self.thread_id
|
|
1016
971
|
)
|
|
1017
972
|
|
|
@@ -1025,7 +980,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1025
980
|
|
|
1026
981
|
def test_get_thread_information_missing_id(self):
|
|
1027
982
|
with self.assertRaises(ValueError) as context:
|
|
1028
|
-
self.client.get_thread_information(
|
|
983
|
+
self.client.get_thread_information(thread_id="")
|
|
1029
984
|
self.assertEqual(str(context.exception), "Thread ID must be provided.")
|
|
1030
985
|
|
|
1031
986
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -1037,7 +992,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1037
992
|
|
|
1038
993
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1039
994
|
self.client.get_thread_information(
|
|
1040
|
-
project_id=self.project_id,
|
|
1041
995
|
thread_id=self.thread_id
|
|
1042
996
|
)
|
|
1043
997
|
|
|
@@ -1052,7 +1006,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1052
1006
|
mock_response.json.return_value = expected_response
|
|
1053
1007
|
|
|
1054
1008
|
result = self.client.send_user_signal(
|
|
1055
|
-
project_id=self.project_id,
|
|
1056
1009
|
instance_id=self.instance_id,
|
|
1057
1010
|
signal_name=self.signal_name
|
|
1058
1011
|
)
|
|
@@ -1069,7 +1022,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1069
1022
|
def test_send_user_signal_missing_instance_id(self):
|
|
1070
1023
|
with self.assertRaises(ValueError) as context:
|
|
1071
1024
|
self.client.send_user_signal(
|
|
1072
|
-
project_id=self.project_id,
|
|
1073
1025
|
instance_id="",
|
|
1074
1026
|
signal_name=self.signal_name
|
|
1075
1027
|
)
|
|
@@ -1078,7 +1030,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1078
1030
|
def test_send_user_signal_missing_signal_name(self):
|
|
1079
1031
|
with self.assertRaises(ValueError) as context:
|
|
1080
1032
|
self.client.send_user_signal(
|
|
1081
|
-
project_id=self.project_id,
|
|
1082
1033
|
instance_id=self.instance_id,
|
|
1083
1034
|
signal_name=""
|
|
1084
1035
|
)
|
|
@@ -1093,7 +1044,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1093
1044
|
|
|
1094
1045
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1095
1046
|
self.client.send_user_signal(
|
|
1096
|
-
project_id=self.project_id,
|
|
1097
1047
|
instance_id=self.instance_id,
|
|
1098
1048
|
signal_name=self.signal_name
|
|
1099
1049
|
)
|
|
@@ -1109,7 +1059,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1109
1059
|
mock_response.json.return_value = expected_response
|
|
1110
1060
|
|
|
1111
1061
|
result = self.client.create_kb(
|
|
1112
|
-
project_id=self.project_id,
|
|
1113
1062
|
name="Test KB",
|
|
1114
1063
|
artifacts=["artifact1"],
|
|
1115
1064
|
metadata=["meta1"]
|
|
@@ -1137,7 +1086,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1137
1086
|
|
|
1138
1087
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1139
1088
|
self.client.create_kb(
|
|
1140
|
-
project_id=self.project_id,
|
|
1141
1089
|
name="Test KB"
|
|
1142
1090
|
)
|
|
1143
1091
|
|
|
@@ -1152,7 +1100,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1152
1100
|
mock_response.json.return_value = expected_response
|
|
1153
1101
|
|
|
1154
1102
|
result = self.client.get_kb(
|
|
1155
|
-
project_id=self.project_id,
|
|
1156
1103
|
kb_id=self.kb_id
|
|
1157
1104
|
)
|
|
1158
1105
|
|
|
@@ -1171,7 +1118,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1171
1118
|
mock_response.json.return_value = expected_response
|
|
1172
1119
|
|
|
1173
1120
|
result = self.client.get_kb(
|
|
1174
|
-
project_id=self.project_id,
|
|
1175
1121
|
kb_name=self.kb_name
|
|
1176
1122
|
)
|
|
1177
1123
|
|
|
@@ -1183,7 +1129,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1183
1129
|
|
|
1184
1130
|
def test_get_kb_missing_identifier(self):
|
|
1185
1131
|
with self.assertRaises(ValueError) as context:
|
|
1186
|
-
self.client.get_kb(
|
|
1132
|
+
self.client.get_kb()
|
|
1187
1133
|
self.assertEqual(str(context.exception), "Either kb_id or kb_name must be provided.")
|
|
1188
1134
|
|
|
1189
1135
|
@patch("pygeai.core.services.rest.ApiService.get")
|
|
@@ -1195,7 +1141,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1195
1141
|
|
|
1196
1142
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1197
1143
|
self.client.get_kb(
|
|
1198
|
-
project_id=self.project_id,
|
|
1199
1144
|
kb_id=self.kb_id
|
|
1200
1145
|
)
|
|
1201
1146
|
|
|
@@ -1210,7 +1155,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1210
1155
|
mock_response.json.return_value = expected_response
|
|
1211
1156
|
|
|
1212
1157
|
result = self.client.list_kbs(
|
|
1213
|
-
project_id=self.project_id,
|
|
1214
1158
|
name="KB1",
|
|
1215
1159
|
start="0",
|
|
1216
1160
|
count="10"
|
|
@@ -1237,7 +1181,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1237
1181
|
mock_response.text = "Invalid JSON response"
|
|
1238
1182
|
|
|
1239
1183
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1240
|
-
self.client.list_kbs(
|
|
1184
|
+
self.client.list_kbs()
|
|
1241
1185
|
|
|
1242
1186
|
self.assertEqual(str(context.exception),
|
|
1243
1187
|
f"Unable to list knowledge bases for project {self.project_id}: Invalid JSON response")
|
|
@@ -1245,12 +1189,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1245
1189
|
|
|
1246
1190
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
1247
1191
|
def test_delete_kb_success_with_id(self, mock_delete):
|
|
1248
|
-
expected_response = {
|
|
1192
|
+
expected_response = {}
|
|
1249
1193
|
mock_response = mock_delete.return_value
|
|
1250
|
-
mock_response.
|
|
1194
|
+
mock_response.status_code = 204
|
|
1251
1195
|
|
|
1252
1196
|
result = self.client.delete_kb(
|
|
1253
|
-
project_id=self.project_id,
|
|
1254
1197
|
kb_id=self.kb_id
|
|
1255
1198
|
)
|
|
1256
1199
|
|
|
@@ -1264,12 +1207,11 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1264
1207
|
|
|
1265
1208
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
1266
1209
|
def test_delete_kb_success_with_name(self, mock_delete):
|
|
1267
|
-
expected_response = {
|
|
1210
|
+
expected_response = {}
|
|
1268
1211
|
mock_response = mock_delete.return_value
|
|
1269
|
-
mock_response.
|
|
1212
|
+
mock_response.status_code = 204
|
|
1270
1213
|
|
|
1271
1214
|
result = self.client.delete_kb(
|
|
1272
|
-
project_id=self.project_id,
|
|
1273
1215
|
kb_name=self.kb_name
|
|
1274
1216
|
)
|
|
1275
1217
|
|
|
@@ -1281,7 +1223,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1281
1223
|
|
|
1282
1224
|
def test_delete_kb_missing_identifier(self):
|
|
1283
1225
|
with self.assertRaises(ValueError) as context:
|
|
1284
|
-
self.client.delete_kb(
|
|
1226
|
+
self.client.delete_kb()
|
|
1285
1227
|
self.assertEqual(str(context.exception), "Either kb_id or kb_name must be provided.")
|
|
1286
1228
|
|
|
1287
1229
|
@patch("pygeai.core.services.rest.ApiService.delete")
|
|
@@ -1293,7 +1235,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1293
1235
|
|
|
1294
1236
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1295
1237
|
self.client.delete_kb(
|
|
1296
|
-
project_id=self.project_id,
|
|
1297
1238
|
kb_id=self.kb_id
|
|
1298
1239
|
)
|
|
1299
1240
|
|
|
@@ -1308,7 +1249,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1308
1249
|
mock_response.json.return_value = expected_response
|
|
1309
1250
|
|
|
1310
1251
|
result = self.client.list_jobs(
|
|
1311
|
-
project_id=self.project_id,
|
|
1312
1252
|
start="0",
|
|
1313
1253
|
count="10",
|
|
1314
1254
|
topic="test-topic",
|
|
@@ -1339,7 +1279,7 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1339
1279
|
mock_response.text = "Invalid JSON response"
|
|
1340
1280
|
|
|
1341
1281
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1342
|
-
self.client.list_jobs(
|
|
1282
|
+
self.client.list_jobs()
|
|
1343
1283
|
|
|
1344
1284
|
self.assertEqual(str(context.exception),
|
|
1345
1285
|
f"Unable to list jobs for project {self.project_id}: Invalid JSON response")
|
|
@@ -1361,7 +1301,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1361
1301
|
}
|
|
1362
1302
|
|
|
1363
1303
|
result = self.client.update_process(
|
|
1364
|
-
project_id=self.project_id,
|
|
1365
1304
|
process_id=self.process_id,
|
|
1366
1305
|
name="Updated Process",
|
|
1367
1306
|
description="Updated Description",
|
|
@@ -1398,7 +1337,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1398
1337
|
}
|
|
1399
1338
|
|
|
1400
1339
|
result = self.client.update_process(
|
|
1401
|
-
project_id=self.project_id,
|
|
1402
1340
|
name=self.process_name,
|
|
1403
1341
|
key="updated-key",
|
|
1404
1342
|
description="Updated Description",
|
|
@@ -1432,7 +1370,6 @@ class TestAgenticProcessClient(unittest.TestCase):
|
|
|
1432
1370
|
|
|
1433
1371
|
with self.assertRaises(InvalidAPIResponseException) as context:
|
|
1434
1372
|
self.client.update_process(
|
|
1435
|
-
project_id=self.project_id,
|
|
1436
1373
|
process_id=self.process_id,
|
|
1437
1374
|
name="Updated Process"
|
|
1438
1375
|
)
|