codemie-test-harness 0.1.135__py3-none-any.whl → 0.1.137__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.
Potentially problematic release.
This version of codemie-test-harness might be problematic. Click here for more details.
- codemie_test_harness/tests/__init__.py +1 -0
- codemie_test_harness/tests/conftest.py +17 -0
- codemie_test_harness/tests/service/test_assistant_service.py +349 -379
- codemie_test_harness/tests/service/test_datasource_service.py +276 -292
- codemie_test_harness/tests/service/test_integration_service.py +133 -122
- codemie_test_harness/tests/service/test_llm_service.py +16 -17
- codemie_test_harness/tests/service/test_task_service.py +108 -120
- codemie_test_harness/tests/service/test_user_service.py +36 -19
- codemie_test_harness/tests/service/test_workflow_execution_service.py +142 -169
- codemie_test_harness/tests/service/test_workflow_service.py +145 -144
- codemie_test_harness/tests/utils/assistant_utils.py +39 -4
- codemie_test_harness/tests/utils/llm_utils.py +9 -0
- codemie_test_harness/tests/utils/search_utils.py +11 -5
- codemie_test_harness/tests/utils/user_utils.py +9 -0
- codemie_test_harness/tests/utils/workflow_utils.py +34 -6
- {codemie_test_harness-0.1.135.dist-info → codemie_test_harness-0.1.137.dist-info}/METADATA +2 -2
- {codemie_test_harness-0.1.135.dist-info → codemie_test_harness-0.1.137.dist-info}/RECORD +19 -17
- {codemie_test_harness-0.1.135.dist-info → codemie_test_harness-0.1.137.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.135.dist-info → codemie_test_harness-0.1.137.dist-info}/entry_points.txt +0 -0
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
"""Integration tests for WorkflowService."""
|
|
2
|
-
|
|
3
1
|
from time import sleep
|
|
4
|
-
|
|
5
2
|
import pytest
|
|
6
3
|
from pydantic import ValidationError
|
|
4
|
+
from hamcrest import (
|
|
5
|
+
assert_that,
|
|
6
|
+
is_not,
|
|
7
|
+
equal_to,
|
|
8
|
+
greater_than,
|
|
9
|
+
has_length,
|
|
10
|
+
is_,
|
|
11
|
+
contains_string,
|
|
12
|
+
any_of,
|
|
13
|
+
less_than_or_equal_to,
|
|
14
|
+
)
|
|
7
15
|
|
|
8
|
-
from codemie_sdk import CodeMieClient
|
|
9
16
|
from codemie_sdk.models.workflow import (
|
|
10
17
|
WorkflowCreateRequest,
|
|
11
18
|
WorkflowUpdateRequest,
|
|
@@ -56,95 +63,85 @@ states:
|
|
|
56
63
|
"""
|
|
57
64
|
|
|
58
65
|
|
|
59
|
-
def
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
description="Workflow that analyzes and generates content about colors",
|
|
69
|
-
project=project,
|
|
70
|
-
yaml_config=valid_workflow_yaml,
|
|
71
|
-
mode=WorkflowMode.SEQUENTIAL,
|
|
72
|
-
shared=False,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
# Create workflow
|
|
76
|
-
created = client.workflows.create_workflow(create_request)
|
|
77
|
-
assert created is not None
|
|
78
|
-
|
|
79
|
-
sleep(5)
|
|
80
|
-
workflows = client.workflows.list(projects=project, per_page=10)
|
|
81
|
-
assert len(workflows) > 0
|
|
82
|
-
workflow = next((wf for wf in workflows if wf.name == workflow_name), None)
|
|
83
|
-
assert workflow.id is not None
|
|
84
|
-
workflow_id = workflow.id
|
|
85
|
-
assert (
|
|
86
|
-
workflow.description
|
|
87
|
-
== "Workflow that analyzes and generates content about colors"
|
|
88
|
-
)
|
|
89
|
-
assert workflow.project == project
|
|
90
|
-
assert workflow.mode == WorkflowMode.SEQUENTIAL
|
|
91
|
-
assert workflow.shared is False
|
|
92
|
-
assert workflow.created_by is not None
|
|
93
|
-
|
|
94
|
-
# Step 2: Update the workflow with modified yaml
|
|
95
|
-
updated_yaml = valid_workflow_yaml.replace(
|
|
96
|
-
"Generate a list 5 colors", "Generate a list of 10 vibrant colors"
|
|
97
|
-
)
|
|
98
|
-
updated_name = f"{workflow_name} Updated"
|
|
99
|
-
update_request = WorkflowUpdateRequest(
|
|
100
|
-
name=updated_name,
|
|
101
|
-
project=project,
|
|
102
|
-
description="Updated color analysis workflow",
|
|
103
|
-
yaml_config=updated_yaml,
|
|
104
|
-
)
|
|
66
|
+
def test_full_workflow_lifecycle(
|
|
67
|
+
workflow_utils, search_utils, valid_workflow_yaml: str
|
|
68
|
+
):
|
|
69
|
+
created = workflow_utils.create_workflow(
|
|
70
|
+
workflow_yaml=valid_workflow_yaml,
|
|
71
|
+
workflow_type=WorkflowMode.SEQUENTIAL,
|
|
72
|
+
description="Workflow that analyzes and generates content about colors",
|
|
73
|
+
project_name=PROJECT,
|
|
74
|
+
)
|
|
105
75
|
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
assert_that(created, is_not(None))
|
|
77
|
+
|
|
78
|
+
sleep(5)
|
|
79
|
+
workflows = search_utils.list_workflows(projects=PROJECT, per_page=10)
|
|
80
|
+
assert_that(workflows, has_length(greater_than(0)))
|
|
81
|
+
workflow = next((wf for wf in workflows if wf.name == created.name), None)
|
|
82
|
+
assert_that(workflow.id, is_not(None))
|
|
83
|
+
workflow_id = workflow.id
|
|
84
|
+
assert_that(
|
|
85
|
+
workflow.description,
|
|
86
|
+
equal_to("Workflow that analyzes and generates content about colors"),
|
|
87
|
+
)
|
|
88
|
+
assert_that(workflow.project, equal_to(PROJECT))
|
|
89
|
+
assert_that(workflow.mode, equal_to(WorkflowMode.SEQUENTIAL))
|
|
90
|
+
assert_that(workflow.shared, is_(False))
|
|
91
|
+
assert_that(workflow.created_by, is_not(None))
|
|
92
|
+
|
|
93
|
+
# Step 2: Update the workflow with modified yaml
|
|
94
|
+
updated_yaml = valid_workflow_yaml.replace(
|
|
95
|
+
"Generate a list 5 colors", "Generate a list of 10 vibrant colors"
|
|
96
|
+
)
|
|
97
|
+
updated_name = f"{created.name} Updated"
|
|
98
|
+
updated = workflow_utils.update_workflow(
|
|
99
|
+
workflow=workflow,
|
|
100
|
+
name=updated_name,
|
|
101
|
+
project=PROJECT,
|
|
102
|
+
description="Updated color analysis workflow",
|
|
103
|
+
yaml_config=updated_yaml,
|
|
104
|
+
)
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
updated_workflow = client.workflows.get(workflow_id)
|
|
111
|
-
assert updated_workflow.name == updated_name
|
|
112
|
-
assert updated_workflow.description == "Updated color analysis workflow"
|
|
113
|
-
assert "Generate a list of 10 vibrant colors" in updated_workflow.yaml_config
|
|
106
|
+
assert_that(updated, is_not(None))
|
|
114
107
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
sleep(5)
|
|
109
|
+
updated_workflow = workflow_utils.get_workflow(workflow_id)
|
|
110
|
+
assert_that(updated_workflow.name, equal_to(updated_name))
|
|
111
|
+
assert_that(
|
|
112
|
+
updated_workflow.description, equal_to("Updated color analysis workflow")
|
|
113
|
+
)
|
|
114
|
+
assert_that(
|
|
115
|
+
updated_workflow.yaml_config,
|
|
116
|
+
contains_string("Generate a list of 10 vibrant colors"),
|
|
117
|
+
)
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
# Step 3: Verify partial update (only name)
|
|
120
|
+
updated_name = f"{created.name} Partially Updated"
|
|
121
|
+
partially_updated = workflow_utils.update_workflow(
|
|
122
|
+
workflow=workflow,
|
|
123
|
+
name=updated_name,
|
|
124
|
+
project=PROJECT,
|
|
125
|
+
description="Updated color analysis workflow",
|
|
126
|
+
yaml_config=updated_yaml,
|
|
127
|
+
)
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
sleep(5)
|
|
130
|
+
partially_updated = workflow_utils.get_workflow(workflow_id)
|
|
131
|
+
assert_that(partially_updated.id, equal_to(workflow_id))
|
|
132
|
+
assert_that(partially_updated.name, equal_to(updated_name))
|
|
133
|
+
# Other fields should remain unchanged
|
|
134
|
+
assert_that(
|
|
135
|
+
partially_updated.description, equal_to("Updated color analysis workflow")
|
|
136
|
+
)
|
|
137
|
+
assert_that(partially_updated.mode, equal_to(WorkflowMode.SEQUENTIAL))
|
|
138
|
+
assert_that(
|
|
139
|
+
partially_updated.yaml_config,
|
|
140
|
+
contains_string("Generate a list of 10 vibrant colors"),
|
|
141
|
+
)
|
|
145
142
|
|
|
146
143
|
|
|
147
|
-
def test_create_workflow_invalid_yaml(
|
|
144
|
+
def test_create_workflow_invalid_yaml(workflow_utils, default_llm):
|
|
148
145
|
"""Test workflow creation with invalid YAML config."""
|
|
149
146
|
invalid_yaml = f"""
|
|
150
147
|
assistants:
|
|
@@ -155,102 +152,106 @@ states:
|
|
|
155
152
|
- missing required fields
|
|
156
153
|
"""
|
|
157
154
|
|
|
158
|
-
create_request = WorkflowCreateRequest(
|
|
159
|
-
name=get_random_name(),
|
|
160
|
-
description="Test workflow with invalid YAML",
|
|
161
|
-
project=PROJECT,
|
|
162
|
-
yaml_config=invalid_yaml,
|
|
163
|
-
)
|
|
164
|
-
|
|
165
155
|
with pytest.raises(Exception) as exc_info:
|
|
166
|
-
|
|
167
|
-
|
|
156
|
+
workflow_utils.create_workflow(
|
|
157
|
+
workflow_yaml=invalid_yaml,
|
|
158
|
+
workflow_type=WorkflowMode.SEQUENTIAL,
|
|
159
|
+
description="Test workflow with invalid YAML",
|
|
160
|
+
project_name=PROJECT,
|
|
161
|
+
)
|
|
162
|
+
assert_that(
|
|
163
|
+
str(exc_info.value).lower(),
|
|
164
|
+
any_of(contains_string("400"), contains_string("invalid")),
|
|
165
|
+
)
|
|
168
166
|
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
def test_update_workflow_not_found(client: CodeMieClient, valid_workflow_yaml: str):
|
|
168
|
+
def test_update_workflow_not_found(workflow_utils, valid_workflow_yaml: str):
|
|
172
169
|
"""Test updating non-existent workflow."""
|
|
173
|
-
update_request = WorkflowUpdateRequest(
|
|
174
|
-
name=get_random_name(),
|
|
175
|
-
description="Updated description",
|
|
176
|
-
yaml_config=valid_workflow_yaml,
|
|
177
|
-
project=PROJECT,
|
|
178
|
-
)
|
|
179
|
-
|
|
180
170
|
with pytest.raises(Exception) as exc_info:
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
request = WorkflowUpdateRequest(
|
|
172
|
+
name=get_random_name(),
|
|
173
|
+
description="description for non-existent workflow",
|
|
174
|
+
yaml_config=valid_workflow_yaml,
|
|
175
|
+
project=PROJECT,
|
|
176
|
+
)
|
|
177
|
+
workflow_utils.send_update_workflow_request(
|
|
178
|
+
workflow_id="non-existent-id", request=request
|
|
179
|
+
)
|
|
180
|
+
assert_that(
|
|
181
|
+
str(exc_info.value).lower(),
|
|
182
|
+
any_of(contains_string("400"), contains_string("not found")),
|
|
183
|
+
)
|
|
183
184
|
|
|
184
185
|
|
|
185
|
-
def
|
|
186
|
-
|
|
187
|
-
# Test with missing required fields
|
|
186
|
+
def test_create_workflow_with_invalid_data(valid_workflow_yaml: str):
|
|
187
|
+
# Test with missing project field
|
|
188
188
|
with pytest.raises(Exception):
|
|
189
189
|
WorkflowCreateRequest(
|
|
190
|
-
name=get_random_name(),
|
|
190
|
+
name=get_random_name(),
|
|
191
191
|
description="Test workflow description",
|
|
192
192
|
yaml_config=valid_workflow_yaml,
|
|
193
193
|
)
|
|
194
194
|
|
|
195
|
-
# Test with invalid mode
|
|
195
|
+
# Test with invalid workflow mode
|
|
196
196
|
with pytest.raises(Exception):
|
|
197
197
|
WorkflowCreateRequest(
|
|
198
198
|
name=get_random_name(),
|
|
199
199
|
description="Test description",
|
|
200
200
|
project=PROJECT,
|
|
201
201
|
yaml_config=valid_workflow_yaml,
|
|
202
|
-
mode="InvalidMode",
|
|
202
|
+
mode="InvalidMode",
|
|
203
203
|
)
|
|
204
204
|
|
|
205
|
-
# Test with empty
|
|
205
|
+
# Test with empty workflow name
|
|
206
206
|
with pytest.raises(Exception):
|
|
207
207
|
WorkflowCreateRequest(
|
|
208
|
-
name="",
|
|
208
|
+
name="",
|
|
209
209
|
description="Test description",
|
|
210
210
|
project=PROJECT,
|
|
211
211
|
yaml_config=valid_workflow_yaml,
|
|
212
212
|
)
|
|
213
213
|
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
def test_create_workflow_project_validation(
|
|
217
|
-
client: CodeMieClient, valid_workflow_yaml: str
|
|
218
|
-
):
|
|
215
|
+
def test_create_workflow_project_validation(workflow_utils, valid_workflow_yaml: str):
|
|
219
216
|
"""Test workflow creation with invalid project."""
|
|
220
|
-
create_request = WorkflowCreateRequest(
|
|
221
|
-
name=get_random_name(),
|
|
222
|
-
description="Test workflow with invalid project",
|
|
223
|
-
project="non-existent-project",
|
|
224
|
-
yaml_config=valid_workflow_yaml,
|
|
225
|
-
)
|
|
226
|
-
|
|
227
217
|
with pytest.raises(Exception) as exc_info:
|
|
228
|
-
|
|
229
|
-
|
|
218
|
+
workflow_utils.send_create_workflow_request(
|
|
219
|
+
project_name="non-existent-project",
|
|
220
|
+
workflow_yaml=valid_workflow_yaml,
|
|
221
|
+
description="Test workflow with invalid project",
|
|
222
|
+
workflow_type=WorkflowMode.SEQUENTIAL,
|
|
223
|
+
)
|
|
224
|
+
assert_that(
|
|
225
|
+
str(exc_info.value).lower(),
|
|
226
|
+
any_of(contains_string("400"), contains_string("project")),
|
|
227
|
+
)
|
|
230
228
|
|
|
231
229
|
|
|
232
|
-
def test_list_workflows(
|
|
233
|
-
|
|
234
|
-
workflows
|
|
235
|
-
assert workflows is not None
|
|
230
|
+
def test_list_workflows(search_utils):
|
|
231
|
+
workflows = search_utils.list_workflows(per_page=2)
|
|
232
|
+
assert_that(workflows, has_length((equal_to(2))))
|
|
236
233
|
|
|
237
|
-
workflows =
|
|
238
|
-
|
|
239
|
-
assert len(workflows) <= 2
|
|
234
|
+
workflows = search_utils.list_workflows(per_page=2, page=1)
|
|
235
|
+
assert_that(workflows, has_length(less_than_or_equal_to(2)))
|
|
240
236
|
|
|
241
237
|
|
|
242
|
-
def
|
|
243
|
-
"""Test listing workflows with invalid parameters."""
|
|
238
|
+
def test_list_workflows_with_invalid_parameters(search_utils):
|
|
244
239
|
# Test invalid page number
|
|
245
240
|
with pytest.raises(ValidationError) as exc_info:
|
|
246
|
-
|
|
247
|
-
|
|
241
|
+
search_utils.list_workflows(page=-1)
|
|
242
|
+
assert_that(
|
|
243
|
+
str(exc_info.value),
|
|
244
|
+
contains_string("Input should be greater than or equal to 0"),
|
|
245
|
+
)
|
|
248
246
|
|
|
249
247
|
# Test invalid per_page value
|
|
250
248
|
with pytest.raises(ValidationError) as exc_info:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
# Test invalid project name
|
|
255
|
-
|
|
256
|
-
|
|
249
|
+
search_utils.list_workflows(per_page=0)
|
|
250
|
+
assert_that(str(exc_info.value), contains_string("Input should be greater than 0"))
|
|
251
|
+
|
|
252
|
+
# Test invalid project name. Should return empty list for non-existent project
|
|
253
|
+
# Skipped. SDK method fix is required
|
|
254
|
+
# workflows = search_utils.list_workflows(projects="nonexistent-project")
|
|
255
|
+
# assert_that(
|
|
256
|
+
# workflows, has_length(equal_to(0))
|
|
257
|
+
# )
|
|
@@ -22,6 +22,8 @@ class AssistantUtils(BaseUtils):
|
|
|
22
22
|
toolkits=(),
|
|
23
23
|
context=(),
|
|
24
24
|
mcp_servers=(),
|
|
25
|
+
slug=None,
|
|
26
|
+
description=None,
|
|
25
27
|
system_prompt="",
|
|
26
28
|
assistant_name=None,
|
|
27
29
|
shared=False,
|
|
@@ -37,8 +39,8 @@ class AssistantUtils(BaseUtils):
|
|
|
37
39
|
)
|
|
38
40
|
request = AssistantCreateRequest(
|
|
39
41
|
name=assistant_name,
|
|
40
|
-
slug=assistant_name,
|
|
41
|
-
description="Integration test assistant",
|
|
42
|
+
slug=slug if slug else assistant_name,
|
|
43
|
+
description=description if description else "Integration test assistant",
|
|
42
44
|
shared=shared,
|
|
43
45
|
system_prompt=system_prompt,
|
|
44
46
|
project=project_name if project_name else PROJECT,
|
|
@@ -62,10 +64,12 @@ class AssistantUtils(BaseUtils):
|
|
|
62
64
|
mcp_servers=(),
|
|
63
65
|
system_prompt="",
|
|
64
66
|
assistant_name=None,
|
|
67
|
+
slug=None,
|
|
65
68
|
shared=False,
|
|
66
69
|
project_name=None,
|
|
67
70
|
top_p=None,
|
|
68
71
|
temperature=None,
|
|
72
|
+
description=None,
|
|
69
73
|
):
|
|
70
74
|
# Generate a random name if assistant_name is not provided
|
|
71
75
|
assistant_name = assistant_name if assistant_name else get_random_name()
|
|
@@ -73,6 +77,7 @@ class AssistantUtils(BaseUtils):
|
|
|
73
77
|
llm_model_type = (
|
|
74
78
|
llm_model_type if llm_model_type else self.client.llms.list()[0].base_name
|
|
75
79
|
)
|
|
80
|
+
slug = slug if slug else assistant_name
|
|
76
81
|
response = self.send_create_assistant_request(
|
|
77
82
|
llm_model_type=llm_model_type,
|
|
78
83
|
toolkits=toolkits,
|
|
@@ -80,10 +85,12 @@ class AssistantUtils(BaseUtils):
|
|
|
80
85
|
mcp_servers=mcp_servers,
|
|
81
86
|
system_prompt=system_prompt,
|
|
82
87
|
assistant_name=assistant_name,
|
|
88
|
+
slug=slug,
|
|
83
89
|
shared=shared,
|
|
84
90
|
project_name=project_name,
|
|
85
91
|
top_p=top_p,
|
|
86
92
|
temperature=temperature,
|
|
93
|
+
description=description,
|
|
87
94
|
)
|
|
88
95
|
|
|
89
96
|
return wait_for_entity(
|
|
@@ -95,6 +102,7 @@ class AssistantUtils(BaseUtils):
|
|
|
95
102
|
self,
|
|
96
103
|
assistant,
|
|
97
104
|
user_prompt,
|
|
105
|
+
minimal_response=True,
|
|
98
106
|
stream=False,
|
|
99
107
|
tools_config=None,
|
|
100
108
|
file_urls=(),
|
|
@@ -113,9 +121,11 @@ class AssistantUtils(BaseUtils):
|
|
|
113
121
|
metadata={"langfuse_traces_enabled": LANGFUSE_TRACES_ENABLED},
|
|
114
122
|
)
|
|
115
123
|
|
|
116
|
-
|
|
124
|
+
response = self.client.assistants.chat(
|
|
117
125
|
assistant_id=assistant.id, request=chat_request
|
|
118
|
-
)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return response.generated if minimal_response else response
|
|
119
129
|
|
|
120
130
|
def send_chat_request(
|
|
121
131
|
self,
|
|
@@ -136,6 +146,25 @@ class AssistantUtils(BaseUtils):
|
|
|
136
146
|
def get_assistant_tools(self):
|
|
137
147
|
return self.client.assistants.get_tools()
|
|
138
148
|
|
|
149
|
+
def get_assistants(
|
|
150
|
+
self,
|
|
151
|
+
minimal_response=True,
|
|
152
|
+
filters=None,
|
|
153
|
+
scope="visible_to_user",
|
|
154
|
+
page=0,
|
|
155
|
+
per_page=12,
|
|
156
|
+
):
|
|
157
|
+
return self.client.assistants.list(
|
|
158
|
+
minimal_response=minimal_response,
|
|
159
|
+
filters=filters,
|
|
160
|
+
scope=scope,
|
|
161
|
+
page=page,
|
|
162
|
+
per_page=per_page,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def get_tasks(self, task_id):
|
|
166
|
+
return self.client.tasks.get(task_id)
|
|
167
|
+
|
|
139
168
|
def get_assistant_by_id(self, assistant_id: str):
|
|
140
169
|
return self.client.assistants.get(assistant_id)
|
|
141
170
|
|
|
@@ -147,6 +176,9 @@ class AssistantUtils(BaseUtils):
|
|
|
147
176
|
def get_assistant_by_slug(self, slug: str):
|
|
148
177
|
return self.client.assistants.get_by_slug(slug)
|
|
149
178
|
|
|
179
|
+
def get_prebuilt_assistant_by_slug(self, slug: str):
|
|
180
|
+
return self.client.assistants.get_prebuilt_by_slug(slug)
|
|
181
|
+
|
|
150
182
|
def update_assistant(
|
|
151
183
|
self, assistant_id: str, update_request: AssistantUpdateRequest
|
|
152
184
|
):
|
|
@@ -167,3 +199,6 @@ class AssistantUtils(BaseUtils):
|
|
|
167
199
|
)
|
|
168
200
|
payload = ExportAssistantPayload(env_vars=env_vars)
|
|
169
201
|
return self.client.assistants.export(assistant_id, payload)
|
|
202
|
+
|
|
203
|
+
def send_evaluate_assistant_request(self, assistant_id: str, evaluation_request):
|
|
204
|
+
return self.client.assistants.evaluate(assistant_id, evaluation_request)
|
|
@@ -6,9 +6,14 @@ class SearchUtils(BaseUtils):
|
|
|
6
6
|
def list_assistants(self, filters):
|
|
7
7
|
return self.client.assistants.list(per_page=100, filters=filters)
|
|
8
8
|
|
|
9
|
-
def list_workflows(self, filters=None, projects=None):
|
|
9
|
+
def list_workflows(self, page=0, per_page=100, filters=None, projects=None):
|
|
10
10
|
return self.client.workflows.list(
|
|
11
|
-
per_page=
|
|
11
|
+
page=page, per_page=per_page, filters=filters, projects=projects
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
def list_workflow_executions(self, test_workflow_id, page=0, per_page=10):
|
|
15
|
+
return self.client.workflows.executions(test_workflow_id).list(
|
|
16
|
+
page=page, per_page=per_page
|
|
12
17
|
)
|
|
13
18
|
|
|
14
19
|
def list_data_sources(
|
|
@@ -18,18 +23,19 @@ class SearchUtils(BaseUtils):
|
|
|
18
23
|
owner=None,
|
|
19
24
|
status=None,
|
|
20
25
|
filters=None,
|
|
26
|
+
per_page=100,
|
|
21
27
|
):
|
|
22
28
|
return self.client.datasources.list(
|
|
23
|
-
per_page=100,
|
|
24
29
|
filters=filters,
|
|
25
30
|
owner=owner,
|
|
26
31
|
status=status,
|
|
27
32
|
datasource_types=datasource_types,
|
|
28
33
|
projects=projects,
|
|
34
|
+
per_page=per_page,
|
|
29
35
|
)
|
|
30
36
|
|
|
31
|
-
def list_integrations(self, setting_type=None, filters=None):
|
|
37
|
+
def list_integrations(self, page=0, per_page=100, setting_type=None, filters=None):
|
|
32
38
|
setting_type = IntegrationType.USER if setting_type is None else setting_type
|
|
33
39
|
return self.client.integrations.list(
|
|
34
|
-
per_page=
|
|
40
|
+
page=page, per_page=per_page, setting_type=setting_type, filters=filters
|
|
35
41
|
)
|
|
@@ -50,6 +50,7 @@ class WorkflowUtils(BaseUtils):
|
|
|
50
50
|
self,
|
|
51
51
|
workflow_yaml,
|
|
52
52
|
workflow_type=WorkflowMode.SEQUENTIAL,
|
|
53
|
+
description=None,
|
|
53
54
|
workflow_name=None,
|
|
54
55
|
shared=False,
|
|
55
56
|
project=None,
|
|
@@ -58,7 +59,7 @@ class WorkflowUtils(BaseUtils):
|
|
|
58
59
|
|
|
59
60
|
request = WorkflowCreateRequest(
|
|
60
61
|
name=workflow_name,
|
|
61
|
-
description="Test Workflow",
|
|
62
|
+
description=description if description else "Test Workflow",
|
|
62
63
|
project=project if project else PROJECT,
|
|
63
64
|
mode=workflow_type,
|
|
64
65
|
yaml_config=workflow_yaml,
|
|
@@ -73,6 +74,7 @@ class WorkflowUtils(BaseUtils):
|
|
|
73
74
|
self,
|
|
74
75
|
workflow_type,
|
|
75
76
|
workflow_yaml,
|
|
77
|
+
description=None,
|
|
76
78
|
workflow_name=None,
|
|
77
79
|
shared=False,
|
|
78
80
|
project_name=None,
|
|
@@ -81,7 +83,12 @@ class WorkflowUtils(BaseUtils):
|
|
|
81
83
|
Sends request to workflow creation endpoint and waits for workflow created.
|
|
82
84
|
"""
|
|
83
85
|
response = self.send_create_workflow_request(
|
|
84
|
-
workflow_yaml,
|
|
86
|
+
workflow_yaml,
|
|
87
|
+
workflow_type,
|
|
88
|
+
description,
|
|
89
|
+
workflow_name,
|
|
90
|
+
shared,
|
|
91
|
+
project_name,
|
|
85
92
|
)
|
|
86
93
|
|
|
87
94
|
return wait_for_entity(
|
|
@@ -104,28 +111,49 @@ class WorkflowUtils(BaseUtils):
|
|
|
104
111
|
wait_for_completion(execution_state_service=states_service, state_id=state.id)
|
|
105
112
|
return states_service.get_output(state_id=state.id).output
|
|
106
113
|
|
|
114
|
+
def run_workflow(self, workflow_id, user_input=""):
|
|
115
|
+
return self.client.workflows.run(workflow_id=workflow_id, user_input=user_input)
|
|
116
|
+
|
|
117
|
+
def get_workflow(self, workflow_id):
|
|
118
|
+
return self.client.workflows.get(workflow_id)
|
|
119
|
+
|
|
120
|
+
def get_workflow_execution(self, test_workflow_id, execution_id):
|
|
121
|
+
return self.client.workflows.executions(test_workflow_id).get(execution_id)
|
|
122
|
+
|
|
123
|
+
def get_workflow_executions_states(self, test_workflow_id, execution_id):
|
|
124
|
+
return self.client.workflows.executions(test_workflow_id).states(execution_id)
|
|
125
|
+
|
|
126
|
+
def send_update_workflow_request(
|
|
127
|
+
self,
|
|
128
|
+
workflow_id,
|
|
129
|
+
request: WorkflowUpdateRequest,
|
|
130
|
+
):
|
|
131
|
+
return self.client.workflows.update(workflow_id, request)
|
|
132
|
+
|
|
107
133
|
def update_workflow(
|
|
108
134
|
self,
|
|
109
135
|
workflow,
|
|
110
136
|
name=None,
|
|
111
137
|
description=None,
|
|
138
|
+
project=None,
|
|
112
139
|
yaml_config=None,
|
|
113
140
|
mode=None,
|
|
114
141
|
shared=None,
|
|
115
142
|
):
|
|
143
|
+
name = name if name else workflow.name
|
|
116
144
|
request = WorkflowUpdateRequest(
|
|
117
|
-
name=name
|
|
118
|
-
project=workflow.project,
|
|
145
|
+
name=name,
|
|
146
|
+
project=project if project else workflow.project,
|
|
119
147
|
description=description if description else workflow.description,
|
|
120
148
|
yaml_config=yaml_config if yaml_config else workflow.yaml_config,
|
|
121
149
|
mode=mode if mode else workflow.mode,
|
|
122
150
|
shared=shared if shared else workflow.shared,
|
|
123
151
|
)
|
|
124
|
-
self.
|
|
152
|
+
self.send_update_workflow_request(workflow.id, request=request)
|
|
125
153
|
|
|
126
154
|
return wait_for_entity(
|
|
127
155
|
lambda: self.client.workflows.list(per_page=200),
|
|
128
|
-
entity_name=
|
|
156
|
+
entity_name=name,
|
|
129
157
|
)
|
|
130
158
|
|
|
131
159
|
def get_prebuilt_workflows(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: codemie-test-harness
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.137
|
|
4
4
|
Summary: Autotest for CodeMie backend and UI
|
|
5
5
|
Author: Anton Yeromin
|
|
6
6
|
Author-email: anton_yeromin@epam.com
|
|
@@ -13,7 +13,7 @@ Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
|
|
|
13
13
|
Requires-Dist: boto3 (>=1.39.8,<2.0.0)
|
|
14
14
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
15
15
|
Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
|
|
16
|
-
Requires-Dist: codemie-sdk-python (==0.1.
|
|
16
|
+
Requires-Dist: codemie-sdk-python (==0.1.137)
|
|
17
17
|
Requires-Dist: pytest (>=8.4.1,<9.0.0)
|
|
18
18
|
Requires-Dist: pytest-playwright (>=0.7.0,<0.8.0)
|
|
19
19
|
Requires-Dist: pytest-reportportal (>=5.5.2,<6.0.0)
|