codemie-test-harness 0.1.221__py3-none-any.whl → 0.1.223__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/conftest.py +18 -0
- codemie_test_harness/tests/test_data/vendor_endpoint_test_data.py +36 -0
- codemie_test_harness/tests/test_data/vendor_test_data.py +43 -0
- codemie_test_harness/tests/test_data/vendor_workflow_test_data.py +50 -0
- codemie_test_harness/tests/utils/vendor_utils.py +343 -0
- codemie_test_harness/tests/utils/vendor_workflow_utils.py +418 -0
- codemie_test_harness/tests/vendor/__init__.py +1 -0
- codemie_test_harness/tests/vendor/assistants/__init__.py +0 -0
- codemie_test_harness/tests/vendor/assistants/test_vendor_assistants.py +65 -0
- codemie_test_harness/tests/vendor/assistants/test_vendor_assistants_endpoints.py +396 -0
- codemie_test_harness/tests/vendor/workflows/__init__.py +1 -0
- codemie_test_harness/tests/vendor/workflows/test_vendor_workflow_endpoints.py +341 -0
- codemie_test_harness/tests/vendor/workflows/test_vendor_workflows.py +63 -0
- {codemie_test_harness-0.1.221.dist-info → codemie_test_harness-0.1.223.dist-info}/METADATA +2 -2
- {codemie_test_harness-0.1.221.dist-info → codemie_test_harness-0.1.223.dist-info}/RECORD +17 -5
- {codemie_test_harness-0.1.221.dist-info → codemie_test_harness-0.1.223.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.221.dist-info → codemie_test_harness-0.1.223.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"""Tests for vendor service SDK endpoints.
|
|
2
|
+
|
|
3
|
+
Architecture:
|
|
4
|
+
- Parametrized tests that support multiple vendors (AWS, Azure, GCP)
|
|
5
|
+
- Extensible design for easy addition of new vendors
|
|
6
|
+
- Uses integration fixture factory for consistent setup
|
|
7
|
+
- Each test validates a specific SDK endpoint
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
from hamcrest import (
|
|
12
|
+
assert_that,
|
|
13
|
+
is_not,
|
|
14
|
+
none,
|
|
15
|
+
empty,
|
|
16
|
+
greater_than,
|
|
17
|
+
instance_of,
|
|
18
|
+
has_length,
|
|
19
|
+
is_,
|
|
20
|
+
)
|
|
21
|
+
from codemie_sdk.models.vendor_assistant import (
|
|
22
|
+
VendorAssistantSettingsResponse,
|
|
23
|
+
VendorAssistantsResponse,
|
|
24
|
+
VendorAssistant,
|
|
25
|
+
VendorAssistantVersion,
|
|
26
|
+
VendorAssistantAliasesResponse,
|
|
27
|
+
VendorAssistantInstallRequest,
|
|
28
|
+
VendorAssistantInstallResponse,
|
|
29
|
+
VendorAssistantUninstallResponse,
|
|
30
|
+
VendorAssistantStatus,
|
|
31
|
+
)
|
|
32
|
+
from codemie_test_harness.tests.test_data.vendor_endpoint_test_data import (
|
|
33
|
+
vendor_endpoint_test_data,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.mark.vendor
|
|
38
|
+
@pytest.mark.api
|
|
39
|
+
@pytest.mark.parametrize(
|
|
40
|
+
"vendor_type,credential_type,credentials",
|
|
41
|
+
vendor_endpoint_test_data,
|
|
42
|
+
)
|
|
43
|
+
def test_get_assistant_settings(
|
|
44
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
45
|
+
):
|
|
46
|
+
"""Test GET /v1/vendors/{vendor}/assistants/settings endpoint."""
|
|
47
|
+
_integration = integration(credential_type, credentials)
|
|
48
|
+
|
|
49
|
+
settings_response = vendor_assistant_utils.get_assistant_settings(
|
|
50
|
+
vendor=vendor_type
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
assert_that(settings_response, instance_of(VendorAssistantSettingsResponse))
|
|
54
|
+
assert_that(settings_response.data, is_not(none()))
|
|
55
|
+
assert_that(settings_response.pagination, is_not(none()))
|
|
56
|
+
assert_that(settings_response.data, is_not(empty()))
|
|
57
|
+
assert_that(settings_response.pagination.total, greater_than(0))
|
|
58
|
+
|
|
59
|
+
created_setting = vendor_assistant_utils.find_setting_for_integration(
|
|
60
|
+
vendor=vendor_type,
|
|
61
|
+
integration_id=_integration.id,
|
|
62
|
+
)
|
|
63
|
+
assert_that(created_setting, is_not(none()))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@pytest.mark.vendor
|
|
67
|
+
@pytest.mark.api
|
|
68
|
+
@pytest.mark.parametrize(
|
|
69
|
+
"vendor_type,credential_type,credentials",
|
|
70
|
+
vendor_endpoint_test_data,
|
|
71
|
+
)
|
|
72
|
+
def test_get_assistants(
|
|
73
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
74
|
+
):
|
|
75
|
+
"""Test GET /v1/vendors/{vendor}/assistants endpoint."""
|
|
76
|
+
_integration = integration(credential_type, credentials)
|
|
77
|
+
|
|
78
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
79
|
+
vendor=vendor_type,
|
|
80
|
+
integration_id=_integration.id,
|
|
81
|
+
)
|
|
82
|
+
assert_that(setting, is_not(none()))
|
|
83
|
+
|
|
84
|
+
assistants_response = vendor_assistant_utils.get_assistants(
|
|
85
|
+
vendor=vendor_type,
|
|
86
|
+
setting_id=setting.setting_id,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
assert_that(assistants_response, instance_of(VendorAssistantsResponse))
|
|
90
|
+
assert_that(assistants_response.data, is_not(none()))
|
|
91
|
+
assert_that(assistants_response.pagination, is_not(none()))
|
|
92
|
+
assert_that(assistants_response.data, is_not(empty()))
|
|
93
|
+
|
|
94
|
+
_assistant = vendor_assistant_utils.get_prepared_assistant(assistants_response.data)
|
|
95
|
+
|
|
96
|
+
assert_that(_assistant.id, is_not(none()))
|
|
97
|
+
assert_that(_assistant.name, is_not(none()))
|
|
98
|
+
assert_that(_assistant.status, is_(VendorAssistantStatus.PREPARED))
|
|
99
|
+
assert_that(_assistant.description, is_not(none()))
|
|
100
|
+
assert_that(_assistant.updatedAt, is_not(none()))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@pytest.mark.vendor
|
|
104
|
+
@pytest.mark.api
|
|
105
|
+
@pytest.mark.parametrize(
|
|
106
|
+
"vendor_type,credential_type,credentials",
|
|
107
|
+
vendor_endpoint_test_data,
|
|
108
|
+
)
|
|
109
|
+
def test_get_assistant(
|
|
110
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
111
|
+
):
|
|
112
|
+
"""Test GET /v1/vendors/{vendor}/assistants/{assistant_id} endpoint."""
|
|
113
|
+
_integration = integration(credential_type, credentials)
|
|
114
|
+
|
|
115
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
116
|
+
vendor=vendor_type,
|
|
117
|
+
integration_id=_integration.id,
|
|
118
|
+
)
|
|
119
|
+
assert_that(setting, is_not(none()))
|
|
120
|
+
|
|
121
|
+
assistants_response = vendor_assistant_utils.get_assistants(
|
|
122
|
+
vendor=vendor_type,
|
|
123
|
+
setting_id=setting.setting_id,
|
|
124
|
+
)
|
|
125
|
+
assert_that(assistants_response.data, is_not(empty()))
|
|
126
|
+
|
|
127
|
+
first_assistant = vendor_assistant_utils.get_prepared_assistant(
|
|
128
|
+
assistants_response.data
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
_assistant = vendor_assistant_utils.get_assistant(
|
|
132
|
+
vendor=vendor_type,
|
|
133
|
+
assistant_id=first_assistant.id,
|
|
134
|
+
setting_id=setting.setting_id,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
assert_that(_assistant, instance_of(VendorAssistant))
|
|
138
|
+
assert_that(_assistant.id, is_(first_assistant.id))
|
|
139
|
+
assert_that(_assistant.name, is_not(none()))
|
|
140
|
+
assert_that(_assistant.status, is_(VendorAssistantStatus.PREPARED))
|
|
141
|
+
assert_that(_assistant.description, is_not(none()))
|
|
142
|
+
assert_that(_assistant.updatedAt, is_not(none()))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@pytest.mark.vendor
|
|
146
|
+
@pytest.mark.api
|
|
147
|
+
@pytest.mark.parametrize(
|
|
148
|
+
"vendor_type,credential_type,credentials",
|
|
149
|
+
vendor_endpoint_test_data,
|
|
150
|
+
)
|
|
151
|
+
def test_get_assistant_version(
|
|
152
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
153
|
+
):
|
|
154
|
+
"""Test GET /v1/vendors/{vendor}/assistants/{assistant_id}/{version} endpoint."""
|
|
155
|
+
_integration = integration(credential_type, credentials)
|
|
156
|
+
|
|
157
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
158
|
+
vendor=vendor_type,
|
|
159
|
+
integration_id=_integration.id,
|
|
160
|
+
)
|
|
161
|
+
assert_that(setting, is_not(none()))
|
|
162
|
+
|
|
163
|
+
assistants_response = vendor_assistant_utils.get_assistants(
|
|
164
|
+
vendor=vendor_type,
|
|
165
|
+
setting_id=setting.setting_id,
|
|
166
|
+
)
|
|
167
|
+
assert_that(assistants_response.data, is_not(empty()))
|
|
168
|
+
|
|
169
|
+
first_assistant = vendor_assistant_utils.get_prepared_assistant(
|
|
170
|
+
assistants_response.data
|
|
171
|
+
)
|
|
172
|
+
aliases_response = vendor_assistant_utils.get_assistant_aliases(
|
|
173
|
+
vendor=vendor_type,
|
|
174
|
+
assistant_id=first_assistant.id,
|
|
175
|
+
setting_id=setting.setting_id,
|
|
176
|
+
)
|
|
177
|
+
assert_that(aliases_response.data, is_not(empty()))
|
|
178
|
+
|
|
179
|
+
first_alias = vendor_assistant_utils.get_non_draft_alias(aliases_response.data)
|
|
180
|
+
|
|
181
|
+
assistant_version = (
|
|
182
|
+
vendor_assistant_utils.vendor_assistant_service.get_assistant_version(
|
|
183
|
+
vendor=vendor_type,
|
|
184
|
+
assistant_id=first_assistant.id,
|
|
185
|
+
version=first_alias.version,
|
|
186
|
+
setting_id=setting.setting_id,
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
assert_that(assistant_version, instance_of(VendorAssistantVersion))
|
|
191
|
+
assert_that(assistant_version.id, is_(first_assistant.id))
|
|
192
|
+
assert_that(assistant_version.name, is_not(none()))
|
|
193
|
+
assert_that(assistant_version.status, is_not(none()))
|
|
194
|
+
assert_that(assistant_version.version, is_(first_alias.version))
|
|
195
|
+
assert_that(assistant_version.instruction, is_not(none()))
|
|
196
|
+
assert_that(assistant_version.foundationModel, is_not(none()))
|
|
197
|
+
assert_that(assistant_version.createdAt, is_not(none()))
|
|
198
|
+
assert_that(assistant_version.updatedAt, is_not(none()))
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
@pytest.mark.vendor
|
|
202
|
+
@pytest.mark.api
|
|
203
|
+
@pytest.mark.parametrize(
|
|
204
|
+
"vendor_type,credential_type,credentials",
|
|
205
|
+
vendor_endpoint_test_data,
|
|
206
|
+
)
|
|
207
|
+
def test_get_assistant_aliases(
|
|
208
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
209
|
+
):
|
|
210
|
+
"""Test GET /v1/vendors/{vendor}/assistants/{assistant_id}/aliases endpoint."""
|
|
211
|
+
_integration = integration(credential_type, credentials)
|
|
212
|
+
|
|
213
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
214
|
+
vendor=vendor_type,
|
|
215
|
+
integration_id=_integration.id,
|
|
216
|
+
)
|
|
217
|
+
assert_that(setting, is_not(none()))
|
|
218
|
+
|
|
219
|
+
assistants_response = vendor_assistant_utils.get_assistants(
|
|
220
|
+
vendor=vendor_type,
|
|
221
|
+
setting_id=setting.setting_id,
|
|
222
|
+
)
|
|
223
|
+
assert_that(assistants_response.data, is_not(empty()))
|
|
224
|
+
|
|
225
|
+
first_assistant = vendor_assistant_utils.get_prepared_assistant(
|
|
226
|
+
assistants_response.data
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
aliases_response = vendor_assistant_utils.get_assistant_aliases(
|
|
230
|
+
vendor=vendor_type,
|
|
231
|
+
assistant_id=first_assistant.id,
|
|
232
|
+
setting_id=setting.setting_id,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
assert_that(aliases_response, instance_of(VendorAssistantAliasesResponse))
|
|
236
|
+
assert_that(aliases_response.data, is_not(none()))
|
|
237
|
+
assert_that(aliases_response.pagination, is_not(none()))
|
|
238
|
+
assert_that(aliases_response.data, is_not(empty()))
|
|
239
|
+
|
|
240
|
+
first_alias = aliases_response.data[0]
|
|
241
|
+
assert_that(first_alias.id, is_not(none()))
|
|
242
|
+
assert_that(first_alias.name, is_not(none()))
|
|
243
|
+
assert_that(first_alias.status, is_not(none()))
|
|
244
|
+
assert_that(first_alias.description, is_not(none()))
|
|
245
|
+
assert_that(first_alias.version, is_not(none()))
|
|
246
|
+
assert_that(first_alias.createdAt, is_not(none()))
|
|
247
|
+
assert_that(first_alias.updatedAt, is_not(none()))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
@pytest.mark.vendor
|
|
251
|
+
@pytest.mark.api
|
|
252
|
+
@pytest.mark.parametrize(
|
|
253
|
+
"vendor_type,credential_type,credentials",
|
|
254
|
+
vendor_endpoint_test_data,
|
|
255
|
+
)
|
|
256
|
+
def test_install_assistants(
|
|
257
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
258
|
+
):
|
|
259
|
+
"""Test POST /v1/vendors/{vendor}/assistants endpoint."""
|
|
260
|
+
_integration = integration(credential_type, credentials)
|
|
261
|
+
|
|
262
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
263
|
+
vendor=vendor_type,
|
|
264
|
+
integration_id=_integration.id,
|
|
265
|
+
)
|
|
266
|
+
assert_that(setting, is_not(none()))
|
|
267
|
+
|
|
268
|
+
result = vendor_assistant_utils.find_first_available_assistant(
|
|
269
|
+
vendor=vendor_type,
|
|
270
|
+
setting_id=setting.setting_id,
|
|
271
|
+
)
|
|
272
|
+
assert_that(result, is_not(none()))
|
|
273
|
+
|
|
274
|
+
_assistant, alias_id = result
|
|
275
|
+
|
|
276
|
+
install_request = VendorAssistantInstallRequest(
|
|
277
|
+
id=_assistant.id,
|
|
278
|
+
agentAliasId=alias_id,
|
|
279
|
+
setting_id=setting.setting_id,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
install_response = vendor_assistant_utils.install_assistants(
|
|
283
|
+
vendor=vendor_type,
|
|
284
|
+
assistants=[install_request],
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
assert_that(install_response, instance_of(VendorAssistantInstallResponse))
|
|
288
|
+
assert_that(install_response.summary, is_not(empty()))
|
|
289
|
+
assert_that(install_response.summary, has_length(1))
|
|
290
|
+
|
|
291
|
+
installed = install_response.summary[0]
|
|
292
|
+
assert_that(installed.agentId, is_(_assistant.id))
|
|
293
|
+
assert_that(installed.agentAliasId, is_(alias_id))
|
|
294
|
+
assert_that(installed.aiRunId, is_not(none()))
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@pytest.mark.vendor
|
|
298
|
+
@pytest.mark.api
|
|
299
|
+
@pytest.mark.parametrize(
|
|
300
|
+
"vendor_type,credential_type,credentials",
|
|
301
|
+
vendor_endpoint_test_data,
|
|
302
|
+
)
|
|
303
|
+
def test_uninstall_assistant(
|
|
304
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
305
|
+
):
|
|
306
|
+
"""Test DELETE /v1/vendors/{vendor}/assistants/{ai_run_id} endpoint."""
|
|
307
|
+
_integration = integration(credential_type, credentials)
|
|
308
|
+
|
|
309
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
310
|
+
vendor=vendor_type,
|
|
311
|
+
integration_id=_integration.id,
|
|
312
|
+
)
|
|
313
|
+
assert_that(setting, is_not(none()))
|
|
314
|
+
|
|
315
|
+
codemie_id = vendor_assistant_utils.install_first_available_assistant(
|
|
316
|
+
vendor=vendor_type,
|
|
317
|
+
setting_id=setting.setting_id,
|
|
318
|
+
)
|
|
319
|
+
assert_that(codemie_id, is_not(none()))
|
|
320
|
+
|
|
321
|
+
uninstall_response = vendor_assistant_utils.uninstall_assistant(
|
|
322
|
+
vendor=vendor_type,
|
|
323
|
+
codemie_id=codemie_id,
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
assert_that(uninstall_response, instance_of(VendorAssistantUninstallResponse))
|
|
327
|
+
assert_that(uninstall_response.success, is_(True))
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
@pytest.mark.vendor
|
|
331
|
+
@pytest.mark.api
|
|
332
|
+
@pytest.mark.parametrize(
|
|
333
|
+
"vendor_type,credential_type,credentials",
|
|
334
|
+
vendor_endpoint_test_data,
|
|
335
|
+
)
|
|
336
|
+
def test_get_assistant_settings_pagination(
|
|
337
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
338
|
+
):
|
|
339
|
+
"""Test pagination functionality for get_assistant_settings endpoint."""
|
|
340
|
+
first_page = vendor_assistant_utils.get_assistant_settings(
|
|
341
|
+
vendor=vendor_type,
|
|
342
|
+
page=0,
|
|
343
|
+
per_page=2,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
assert_that(first_page.pagination.page, is_(0))
|
|
347
|
+
assert_that(first_page.pagination.per_page, is_(2))
|
|
348
|
+
assert_that(first_page.pagination.total, greater_than(0))
|
|
349
|
+
|
|
350
|
+
if first_page.pagination.pages > 1:
|
|
351
|
+
second_page = vendor_assistant_utils.get_assistant_settings(
|
|
352
|
+
vendor=vendor_type,
|
|
353
|
+
page=1,
|
|
354
|
+
per_page=2,
|
|
355
|
+
)
|
|
356
|
+
assert_that(second_page.pagination.page, is_(1))
|
|
357
|
+
assert_that(second_page.data, is_not(empty()))
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
@pytest.mark.vendor
|
|
361
|
+
@pytest.mark.api
|
|
362
|
+
@pytest.mark.parametrize(
|
|
363
|
+
"vendor_type,credential_type,credentials",
|
|
364
|
+
vendor_endpoint_test_data,
|
|
365
|
+
)
|
|
366
|
+
def test_get_assistants_pagination(
|
|
367
|
+
vendor_assistant_utils, integration, vendor_type, credential_type, credentials
|
|
368
|
+
):
|
|
369
|
+
"""Test pagination functionality for get_assistants endpoint using next_token."""
|
|
370
|
+
_integration = integration(credential_type, credentials)
|
|
371
|
+
|
|
372
|
+
setting = vendor_assistant_utils.find_setting_for_integration(
|
|
373
|
+
vendor=vendor_type,
|
|
374
|
+
integration_id=_integration.id,
|
|
375
|
+
)
|
|
376
|
+
assert_that(setting, is_not(none()))
|
|
377
|
+
|
|
378
|
+
first_page = vendor_assistant_utils.get_assistants(
|
|
379
|
+
vendor=vendor_type,
|
|
380
|
+
setting_id=setting.setting_id,
|
|
381
|
+
per_page=2,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
assert_that(first_page.data, is_not(empty()))
|
|
385
|
+
|
|
386
|
+
if first_page.pagination.next_token:
|
|
387
|
+
second_page = vendor_assistant_utils.get_assistants(
|
|
388
|
+
vendor=vendor_type,
|
|
389
|
+
setting_id=setting.setting_id,
|
|
390
|
+
per_page=2,
|
|
391
|
+
next_token=first_page.pagination.next_token,
|
|
392
|
+
)
|
|
393
|
+
assert_that(second_page.data, is_not(empty()))
|
|
394
|
+
first_page_ids = {a.id for a in first_page.data}
|
|
395
|
+
second_page_ids = {a.id for a in second_page.data}
|
|
396
|
+
assert_that(first_page_ids.intersection(second_page_ids), is_(set()))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Vendor workflows tests package."""
|