codemie-test-harness 0.1.222__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.

@@ -41,12 +41,14 @@ from codemie_test_harness.tests.test_data.vendor_endpoint_test_data import (
41
41
  vendor_endpoint_test_data,
42
42
  )
43
43
  def test_get_assistant_settings(
44
- vendor_utils, integration, vendor_type, credential_type, credentials
44
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
45
45
  ):
46
46
  """Test GET /v1/vendors/{vendor}/assistants/settings endpoint."""
47
47
  _integration = integration(credential_type, credentials)
48
48
 
49
- settings_response = vendor_utils.get_assistant_settings(vendor=vendor_type)
49
+ settings_response = vendor_assistant_utils.get_assistant_settings(
50
+ vendor=vendor_type
51
+ )
50
52
 
51
53
  assert_that(settings_response, instance_of(VendorAssistantSettingsResponse))
52
54
  assert_that(settings_response.data, is_not(none()))
@@ -54,7 +56,7 @@ def test_get_assistant_settings(
54
56
  assert_that(settings_response.data, is_not(empty()))
55
57
  assert_that(settings_response.pagination.total, greater_than(0))
56
58
 
57
- created_setting = vendor_utils.find_setting_for_integration(
59
+ created_setting = vendor_assistant_utils.find_setting_for_integration(
58
60
  vendor=vendor_type,
59
61
  integration_id=_integration.id,
60
62
  )
@@ -68,18 +70,18 @@ def test_get_assistant_settings(
68
70
  vendor_endpoint_test_data,
69
71
  )
70
72
  def test_get_assistants(
71
- vendor_utils, integration, vendor_type, credential_type, credentials
73
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
72
74
  ):
73
75
  """Test GET /v1/vendors/{vendor}/assistants endpoint."""
74
76
  _integration = integration(credential_type, credentials)
75
77
 
76
- setting = vendor_utils.find_setting_for_integration(
78
+ setting = vendor_assistant_utils.find_setting_for_integration(
77
79
  vendor=vendor_type,
78
80
  integration_id=_integration.id,
79
81
  )
80
82
  assert_that(setting, is_not(none()))
81
83
 
82
- assistants_response = vendor_utils.get_assistants(
84
+ assistants_response = vendor_assistant_utils.get_assistants(
83
85
  vendor=vendor_type,
84
86
  setting_id=setting.setting_id,
85
87
  )
@@ -89,7 +91,7 @@ def test_get_assistants(
89
91
  assert_that(assistants_response.pagination, is_not(none()))
90
92
  assert_that(assistants_response.data, is_not(empty()))
91
93
 
92
- _assistant = vendor_utils.get_prepared_assistant(assistants_response.data)
94
+ _assistant = vendor_assistant_utils.get_prepared_assistant(assistants_response.data)
93
95
 
94
96
  assert_that(_assistant.id, is_not(none()))
95
97
  assert_that(_assistant.name, is_not(none()))
@@ -105,26 +107,28 @@ def test_get_assistants(
105
107
  vendor_endpoint_test_data,
106
108
  )
107
109
  def test_get_assistant(
108
- vendor_utils, integration, vendor_type, credential_type, credentials
110
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
109
111
  ):
110
112
  """Test GET /v1/vendors/{vendor}/assistants/{assistant_id} endpoint."""
111
113
  _integration = integration(credential_type, credentials)
112
114
 
113
- setting = vendor_utils.find_setting_for_integration(
115
+ setting = vendor_assistant_utils.find_setting_for_integration(
114
116
  vendor=vendor_type,
115
117
  integration_id=_integration.id,
116
118
  )
117
119
  assert_that(setting, is_not(none()))
118
120
 
119
- assistants_response = vendor_utils.get_assistants(
121
+ assistants_response = vendor_assistant_utils.get_assistants(
120
122
  vendor=vendor_type,
121
123
  setting_id=setting.setting_id,
122
124
  )
123
125
  assert_that(assistants_response.data, is_not(empty()))
124
126
 
125
- first_assistant = vendor_utils.get_prepared_assistant(assistants_response.data)
127
+ first_assistant = vendor_assistant_utils.get_prepared_assistant(
128
+ assistants_response.data
129
+ )
126
130
 
127
- _assistant = vendor_utils.get_assistant(
131
+ _assistant = vendor_assistant_utils.get_assistant(
128
132
  vendor=vendor_type,
129
133
  assistant_id=first_assistant.id,
130
134
  setting_id=setting.setting_id,
@@ -145,38 +149,42 @@ def test_get_assistant(
145
149
  vendor_endpoint_test_data,
146
150
  )
147
151
  def test_get_assistant_version(
148
- vendor_utils, integration, vendor_type, credential_type, credentials
152
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
149
153
  ):
150
154
  """Test GET /v1/vendors/{vendor}/assistants/{assistant_id}/{version} endpoint."""
151
155
  _integration = integration(credential_type, credentials)
152
156
 
153
- setting = vendor_utils.find_setting_for_integration(
157
+ setting = vendor_assistant_utils.find_setting_for_integration(
154
158
  vendor=vendor_type,
155
159
  integration_id=_integration.id,
156
160
  )
157
161
  assert_that(setting, is_not(none()))
158
162
 
159
- assistants_response = vendor_utils.get_assistants(
163
+ assistants_response = vendor_assistant_utils.get_assistants(
160
164
  vendor=vendor_type,
161
165
  setting_id=setting.setting_id,
162
166
  )
163
167
  assert_that(assistants_response.data, is_not(empty()))
164
168
 
165
- first_assistant = vendor_utils.get_prepared_assistant(assistants_response.data)
166
- aliases_response = vendor_utils.get_assistant_aliases(
169
+ first_assistant = vendor_assistant_utils.get_prepared_assistant(
170
+ assistants_response.data
171
+ )
172
+ aliases_response = vendor_assistant_utils.get_assistant_aliases(
167
173
  vendor=vendor_type,
168
174
  assistant_id=first_assistant.id,
169
175
  setting_id=setting.setting_id,
170
176
  )
171
177
  assert_that(aliases_response.data, is_not(empty()))
172
178
 
173
- first_alias = vendor_utils.get_non_draft_alias(aliases_response.data)
179
+ first_alias = vendor_assistant_utils.get_non_draft_alias(aliases_response.data)
174
180
 
175
- assistant_version = vendor_utils.vendor_service.get_assistant_version(
176
- vendor=vendor_type,
177
- assistant_id=first_assistant.id,
178
- version=first_alias.version,
179
- setting_id=setting.setting_id,
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
+ )
180
188
  )
181
189
 
182
190
  assert_that(assistant_version, instance_of(VendorAssistantVersion))
@@ -197,26 +205,28 @@ def test_get_assistant_version(
197
205
  vendor_endpoint_test_data,
198
206
  )
199
207
  def test_get_assistant_aliases(
200
- vendor_utils, integration, vendor_type, credential_type, credentials
208
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
201
209
  ):
202
210
  """Test GET /v1/vendors/{vendor}/assistants/{assistant_id}/aliases endpoint."""
203
211
  _integration = integration(credential_type, credentials)
204
212
 
205
- setting = vendor_utils.find_setting_for_integration(
213
+ setting = vendor_assistant_utils.find_setting_for_integration(
206
214
  vendor=vendor_type,
207
215
  integration_id=_integration.id,
208
216
  )
209
217
  assert_that(setting, is_not(none()))
210
218
 
211
- assistants_response = vendor_utils.get_assistants(
219
+ assistants_response = vendor_assistant_utils.get_assistants(
212
220
  vendor=vendor_type,
213
221
  setting_id=setting.setting_id,
214
222
  )
215
223
  assert_that(assistants_response.data, is_not(empty()))
216
224
 
217
- first_assistant = vendor_utils.get_prepared_assistant(assistants_response.data)
225
+ first_assistant = vendor_assistant_utils.get_prepared_assistant(
226
+ assistants_response.data
227
+ )
218
228
 
219
- aliases_response = vendor_utils.get_assistant_aliases(
229
+ aliases_response = vendor_assistant_utils.get_assistant_aliases(
220
230
  vendor=vendor_type,
221
231
  assistant_id=first_assistant.id,
222
232
  setting_id=setting.setting_id,
@@ -244,18 +254,18 @@ def test_get_assistant_aliases(
244
254
  vendor_endpoint_test_data,
245
255
  )
246
256
  def test_install_assistants(
247
- vendor_utils, integration, vendor_type, credential_type, credentials
257
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
248
258
  ):
249
259
  """Test POST /v1/vendors/{vendor}/assistants endpoint."""
250
260
  _integration = integration(credential_type, credentials)
251
261
 
252
- setting = vendor_utils.find_setting_for_integration(
262
+ setting = vendor_assistant_utils.find_setting_for_integration(
253
263
  vendor=vendor_type,
254
264
  integration_id=_integration.id,
255
265
  )
256
266
  assert_that(setting, is_not(none()))
257
267
 
258
- result = vendor_utils.find_first_available_assistant(
268
+ result = vendor_assistant_utils.find_first_available_assistant(
259
269
  vendor=vendor_type,
260
270
  setting_id=setting.setting_id,
261
271
  )
@@ -269,7 +279,7 @@ def test_install_assistants(
269
279
  setting_id=setting.setting_id,
270
280
  )
271
281
 
272
- install_response = vendor_utils.install_assistants(
282
+ install_response = vendor_assistant_utils.install_assistants(
273
283
  vendor=vendor_type,
274
284
  assistants=[install_request],
275
285
  )
@@ -291,24 +301,24 @@ def test_install_assistants(
291
301
  vendor_endpoint_test_data,
292
302
  )
293
303
  def test_uninstall_assistant(
294
- vendor_utils, integration, vendor_type, credential_type, credentials
304
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
295
305
  ):
296
306
  """Test DELETE /v1/vendors/{vendor}/assistants/{ai_run_id} endpoint."""
297
307
  _integration = integration(credential_type, credentials)
298
308
 
299
- setting = vendor_utils.find_setting_for_integration(
309
+ setting = vendor_assistant_utils.find_setting_for_integration(
300
310
  vendor=vendor_type,
301
311
  integration_id=_integration.id,
302
312
  )
303
313
  assert_that(setting, is_not(none()))
304
314
 
305
- codemie_id = vendor_utils.install_first_available_assistant(
315
+ codemie_id = vendor_assistant_utils.install_first_available_assistant(
306
316
  vendor=vendor_type,
307
317
  setting_id=setting.setting_id,
308
318
  )
309
319
  assert_that(codemie_id, is_not(none()))
310
320
 
311
- uninstall_response = vendor_utils.uninstall_assistant(
321
+ uninstall_response = vendor_assistant_utils.uninstall_assistant(
312
322
  vendor=vendor_type,
313
323
  codemie_id=codemie_id,
314
324
  )
@@ -324,10 +334,10 @@ def test_uninstall_assistant(
324
334
  vendor_endpoint_test_data,
325
335
  )
326
336
  def test_get_assistant_settings_pagination(
327
- vendor_utils, integration, vendor_type, credential_type, credentials
337
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
328
338
  ):
329
339
  """Test pagination functionality for get_assistant_settings endpoint."""
330
- first_page = vendor_utils.get_assistant_settings(
340
+ first_page = vendor_assistant_utils.get_assistant_settings(
331
341
  vendor=vendor_type,
332
342
  page=0,
333
343
  per_page=2,
@@ -338,7 +348,7 @@ def test_get_assistant_settings_pagination(
338
348
  assert_that(first_page.pagination.total, greater_than(0))
339
349
 
340
350
  if first_page.pagination.pages > 1:
341
- second_page = vendor_utils.get_assistant_settings(
351
+ second_page = vendor_assistant_utils.get_assistant_settings(
342
352
  vendor=vendor_type,
343
353
  page=1,
344
354
  per_page=2,
@@ -354,18 +364,18 @@ def test_get_assistant_settings_pagination(
354
364
  vendor_endpoint_test_data,
355
365
  )
356
366
  def test_get_assistants_pagination(
357
- vendor_utils, integration, vendor_type, credential_type, credentials
367
+ vendor_assistant_utils, integration, vendor_type, credential_type, credentials
358
368
  ):
359
369
  """Test pagination functionality for get_assistants endpoint using next_token."""
360
370
  _integration = integration(credential_type, credentials)
361
371
 
362
- setting = vendor_utils.find_setting_for_integration(
372
+ setting = vendor_assistant_utils.find_setting_for_integration(
363
373
  vendor=vendor_type,
364
374
  integration_id=_integration.id,
365
375
  )
366
376
  assert_that(setting, is_not(none()))
367
377
 
368
- first_page = vendor_utils.get_assistants(
378
+ first_page = vendor_assistant_utils.get_assistants(
369
379
  vendor=vendor_type,
370
380
  setting_id=setting.setting_id,
371
381
  per_page=2,
@@ -374,7 +384,7 @@ def test_get_assistants_pagination(
374
384
  assert_that(first_page.data, is_not(empty()))
375
385
 
376
386
  if first_page.pagination.next_token:
377
- second_page = vendor_utils.get_assistants(
387
+ second_page = vendor_assistant_utils.get_assistants(
378
388
  vendor=vendor_type,
379
389
  setting_id=setting.setting_id,
380
390
  per_page=2,
@@ -0,0 +1 @@
1
+ """Vendor workflows tests package."""
@@ -0,0 +1,341 @@
1
+ """Tests for vendor workflow 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_workflow import (
22
+ VendorWorkflowSettingsResponse,
23
+ VendorWorkflowsResponse,
24
+ VendorWorkflow,
25
+ VendorWorkflowAliasesResponse,
26
+ VendorWorkflowInstallRequest,
27
+ VendorWorkflowInstallResponse,
28
+ VendorWorkflowUninstallResponse,
29
+ VendorWorkflowStatus,
30
+ )
31
+ from codemie_test_harness.tests.test_data.vendor_endpoint_test_data import (
32
+ vendor_endpoint_test_data,
33
+ )
34
+
35
+
36
+ @pytest.mark.vendor
37
+ @pytest.mark.api
38
+ @pytest.mark.parametrize(
39
+ "vendor_type,credential_type,credentials",
40
+ vendor_endpoint_test_data,
41
+ )
42
+ def test_get_workflow_settings(
43
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
44
+ ):
45
+ """Test GET /v1/vendors/{vendor}/workflows/settings endpoint."""
46
+ _integration = integration(credential_type, credentials)
47
+
48
+ settings_response = vendor_workflow_utils.get_workflow_settings(vendor=vendor_type)
49
+
50
+ assert_that(settings_response, instance_of(VendorWorkflowSettingsResponse))
51
+ assert_that(settings_response.data, is_not(none()))
52
+ assert_that(settings_response.pagination, is_not(none()))
53
+ assert_that(settings_response.data, is_not(empty()))
54
+ assert_that(settings_response.pagination.total, greater_than(0))
55
+
56
+ created_setting = vendor_workflow_utils.find_setting_for_integration(
57
+ vendor=vendor_type,
58
+ integration_id=_integration.id,
59
+ )
60
+ assert_that(created_setting, is_not(none()))
61
+
62
+
63
+ @pytest.mark.vendor
64
+ @pytest.mark.api
65
+ @pytest.mark.parametrize(
66
+ "vendor_type,credential_type,credentials",
67
+ vendor_endpoint_test_data,
68
+ )
69
+ def test_get_workflows(
70
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
71
+ ):
72
+ """Test GET /v1/vendors/{vendor}/workflows endpoint."""
73
+ _integration = integration(credential_type, credentials)
74
+
75
+ setting = vendor_workflow_utils.find_setting_for_integration(
76
+ vendor=vendor_type,
77
+ integration_id=_integration.id,
78
+ )
79
+ assert_that(setting, is_not(none()))
80
+
81
+ workflows_response = vendor_workflow_utils.get_workflows(
82
+ vendor=vendor_type,
83
+ setting_id=setting.setting_id,
84
+ )
85
+
86
+ assert_that(workflows_response, instance_of(VendorWorkflowsResponse))
87
+ assert_that(workflows_response.data, is_not(none()))
88
+ assert_that(workflows_response.pagination, is_not(none()))
89
+ assert_that(workflows_response.data, is_not(empty()))
90
+
91
+ _workflow = vendor_workflow_utils.get_prepared_workflow(workflows_response.data)
92
+
93
+ assert_that(_workflow.id, is_not(none()))
94
+ assert_that(_workflow.name, is_not(none()))
95
+ assert_that(_workflow.status, is_(VendorWorkflowStatus.PREPARED))
96
+ assert_that(_workflow.description, is_not(none()))
97
+ assert_that(_workflow.version, is_not(none()))
98
+ assert_that(_workflow.createdAt, is_not(none()))
99
+ assert_that(_workflow.updatedAt, is_not(none()))
100
+
101
+
102
+ @pytest.mark.vendor
103
+ @pytest.mark.api
104
+ @pytest.mark.parametrize(
105
+ "vendor_type,credential_type,credentials",
106
+ vendor_endpoint_test_data,
107
+ )
108
+ def test_get_workflow(
109
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
110
+ ):
111
+ """Test GET /v1/vendors/{vendor}/workflows/{workflow_id} endpoint."""
112
+ _integration = integration(credential_type, credentials)
113
+
114
+ setting = vendor_workflow_utils.find_setting_for_integration(
115
+ vendor=vendor_type,
116
+ integration_id=_integration.id,
117
+ )
118
+ assert_that(setting, is_not(none()))
119
+
120
+ workflows_response = vendor_workflow_utils.get_workflows(
121
+ vendor=vendor_type,
122
+ setting_id=setting.setting_id,
123
+ )
124
+ assert_that(workflows_response.data, is_not(empty()))
125
+
126
+ first_workflow = vendor_workflow_utils.get_prepared_workflow(
127
+ workflows_response.data
128
+ )
129
+
130
+ _workflow = vendor_workflow_utils.get_workflow(
131
+ vendor=vendor_type,
132
+ workflow_id=first_workflow.id,
133
+ setting_id=setting.setting_id,
134
+ )
135
+
136
+ assert_that(_workflow, instance_of(VendorWorkflow))
137
+ assert_that(_workflow.id, is_(first_workflow.id))
138
+ assert_that(_workflow.name, is_not(none()))
139
+ assert_that(_workflow.status, is_(VendorWorkflowStatus.PREPARED))
140
+ assert_that(_workflow.description, is_not(none()))
141
+ assert_that(_workflow.version, is_not(none()))
142
+ assert_that(_workflow.createdAt, is_not(none()))
143
+ assert_that(_workflow.updatedAt, is_not(none()))
144
+
145
+
146
+ @pytest.mark.vendor
147
+ @pytest.mark.api
148
+ @pytest.mark.parametrize(
149
+ "vendor_type,credential_type,credentials",
150
+ vendor_endpoint_test_data,
151
+ )
152
+ def test_get_workflow_aliases(
153
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
154
+ ):
155
+ """Test GET /v1/vendors/{vendor}/workflows/{workflow_id}/aliases endpoint."""
156
+ _integration = integration(credential_type, credentials)
157
+
158
+ setting = vendor_workflow_utils.find_setting_for_integration(
159
+ vendor=vendor_type,
160
+ integration_id=_integration.id,
161
+ )
162
+ assert_that(setting, is_not(none()))
163
+
164
+ workflows_response = vendor_workflow_utils.get_workflows(
165
+ vendor=vendor_type,
166
+ setting_id=setting.setting_id,
167
+ )
168
+ assert_that(workflows_response.data, is_not(empty()))
169
+
170
+ first_workflow = vendor_workflow_utils.get_prepared_workflow(
171
+ workflows_response.data
172
+ )
173
+
174
+ aliases_response = vendor_workflow_utils.get_workflow_aliases(
175
+ vendor=vendor_type,
176
+ workflow_id=first_workflow.id,
177
+ setting_id=setting.setting_id,
178
+ )
179
+
180
+ assert_that(aliases_response, instance_of(VendorWorkflowAliasesResponse))
181
+ assert_that(aliases_response.data, is_not(none()))
182
+ assert_that(aliases_response.pagination, is_not(none()))
183
+ assert_that(aliases_response.data, is_not(empty()))
184
+
185
+ first_alias = aliases_response.data[0]
186
+ assert_that(first_alias.id, is_not(none()))
187
+ assert_that(first_alias.name, is_not(none()))
188
+ assert_that(first_alias.status, is_not(none()))
189
+ assert_that(first_alias.description, is_not(none()))
190
+ assert_that(first_alias.version, is_not(none()))
191
+ assert_that(first_alias.createdAt, is_not(none()))
192
+ assert_that(first_alias.updatedAt, is_not(none()))
193
+
194
+
195
+ @pytest.mark.vendor
196
+ @pytest.mark.api
197
+ @pytest.mark.parametrize(
198
+ "vendor_type,credential_type,credentials",
199
+ vendor_endpoint_test_data,
200
+ )
201
+ def test_install_workflows(
202
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
203
+ ):
204
+ """Test POST /v1/vendors/{vendor}/workflows endpoint."""
205
+ _integration = integration(credential_type, credentials)
206
+
207
+ setting = vendor_workflow_utils.find_setting_for_integration(
208
+ vendor=vendor_type,
209
+ integration_id=_integration.id,
210
+ )
211
+ assert_that(setting, is_not(none()))
212
+
213
+ result = vendor_workflow_utils.find_first_available_workflow(
214
+ vendor=vendor_type,
215
+ setting_id=setting.setting_id,
216
+ )
217
+ assert_that(result, is_not(none()))
218
+
219
+ _workflow, alias_id = result
220
+
221
+ install_request = VendorWorkflowInstallRequest(
222
+ id=_workflow.id,
223
+ flowAliasId=alias_id,
224
+ setting_id=setting.setting_id,
225
+ )
226
+
227
+ install_response = vendor_workflow_utils.install_workflows(
228
+ vendor=vendor_type,
229
+ workflows=[install_request],
230
+ )
231
+
232
+ assert_that(install_response, instance_of(VendorWorkflowInstallResponse))
233
+ assert_that(install_response.summary, is_not(empty()))
234
+ assert_that(install_response.summary, has_length(1))
235
+
236
+ installed = install_response.summary[0]
237
+ assert_that(installed.flowId, is_(_workflow.id))
238
+ assert_that(installed.flowAliasId, is_(alias_id))
239
+ assert_that(installed.aiRunId, is_not(none()))
240
+
241
+
242
+ @pytest.mark.vendor
243
+ @pytest.mark.api
244
+ @pytest.mark.parametrize(
245
+ "vendor_type,credential_type,credentials",
246
+ vendor_endpoint_test_data,
247
+ )
248
+ def test_uninstall_workflow(
249
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
250
+ ):
251
+ """Test DELETE /v1/vendors/{vendor}/workflows/{ai_run_id} endpoint."""
252
+ _integration = integration(credential_type, credentials)
253
+
254
+ setting = vendor_workflow_utils.find_setting_for_integration(
255
+ vendor=vendor_type,
256
+ integration_id=_integration.id,
257
+ )
258
+ assert_that(setting, is_not(none()))
259
+
260
+ codemie_id = vendor_workflow_utils.install_first_available_workflow(
261
+ vendor=vendor_type,
262
+ setting_id=setting.setting_id,
263
+ )
264
+ assert_that(codemie_id, is_not(none()))
265
+
266
+ uninstall_response = vendor_workflow_utils.uninstall_workflow(
267
+ vendor=vendor_type,
268
+ codemie_id=codemie_id,
269
+ )
270
+
271
+ assert_that(uninstall_response, instance_of(VendorWorkflowUninstallResponse))
272
+ assert_that(uninstall_response.success, is_(True))
273
+
274
+
275
+ @pytest.mark.vendor
276
+ @pytest.mark.api
277
+ @pytest.mark.parametrize(
278
+ "vendor_type,credential_type,credentials",
279
+ vendor_endpoint_test_data,
280
+ )
281
+ def test_get_workflow_settings_pagination(
282
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
283
+ ):
284
+ """Test pagination functionality for get_workflow_settings endpoint."""
285
+ first_page = vendor_workflow_utils.get_workflow_settings(
286
+ vendor=vendor_type,
287
+ page=0,
288
+ per_page=2,
289
+ )
290
+
291
+ assert_that(first_page.pagination.page, is_(0))
292
+ assert_that(first_page.pagination.per_page, is_(2))
293
+ assert_that(first_page.pagination.total, greater_than(0))
294
+
295
+ if first_page.pagination.pages > 1:
296
+ second_page = vendor_workflow_utils.get_workflow_settings(
297
+ vendor=vendor_type,
298
+ page=1,
299
+ per_page=2,
300
+ )
301
+ assert_that(second_page.pagination.page, is_(1))
302
+ assert_that(second_page.data, is_not(empty()))
303
+
304
+
305
+ @pytest.mark.vendor
306
+ @pytest.mark.api
307
+ @pytest.mark.parametrize(
308
+ "vendor_type,credential_type,credentials",
309
+ vendor_endpoint_test_data,
310
+ )
311
+ def test_get_workflows_pagination(
312
+ vendor_workflow_utils, integration, vendor_type, credential_type, credentials
313
+ ):
314
+ """Test pagination functionality for get_workflows endpoint using next_token."""
315
+ _integration = integration(credential_type, credentials)
316
+
317
+ setting = vendor_workflow_utils.find_setting_for_integration(
318
+ vendor=vendor_type,
319
+ integration_id=_integration.id,
320
+ )
321
+ assert_that(setting, is_not(none()))
322
+
323
+ first_page = vendor_workflow_utils.get_workflows(
324
+ vendor=vendor_type,
325
+ setting_id=setting.setting_id,
326
+ per_page=2,
327
+ )
328
+
329
+ assert_that(first_page.data, is_not(empty()))
330
+
331
+ if first_page.pagination.next_token:
332
+ second_page = vendor_workflow_utils.get_workflows(
333
+ vendor=vendor_type,
334
+ setting_id=setting.setting_id,
335
+ per_page=2,
336
+ next_token=first_page.pagination.next_token,
337
+ )
338
+ assert_that(second_page.data, is_not(empty()))
339
+ first_page_ids = {w.id for w in first_page.data}
340
+ second_page_ids = {w.id for w in second_page.data}
341
+ assert_that(first_page_ids.intersection(second_page_ids), is_(set()))
@@ -0,0 +1,63 @@
1
+ import pytest
2
+ from hamcrest import assert_that, is_not, none, is_
3
+
4
+ from codemie_test_harness.tests.test_data.vendor_workflow_test_data import (
5
+ vendor_workflow_test_data,
6
+ )
7
+
8
+
9
+ @pytest.mark.vendor
10
+ @pytest.mark.workflow
11
+ @pytest.mark.api
12
+ @pytest.mark.parametrize(
13
+ "vendor_type,credential_type,credentials,workflow_name,user_input,expected_response",
14
+ vendor_workflow_test_data,
15
+ )
16
+ def test_vendor_workflow_installation_and_execution(
17
+ vendor_workflow_utils,
18
+ integration,
19
+ workflow_utils,
20
+ similarity_check,
21
+ vendor_type,
22
+ credential_type,
23
+ credentials,
24
+ workflow_name,
25
+ user_input,
26
+ expected_response,
27
+ ):
28
+ """Test vendor workflow installation and execution functionality."""
29
+ _integration = integration(credential_type, credentials)
30
+
31
+ setting = vendor_workflow_utils.find_setting_for_integration(
32
+ vendor=vendor_type,
33
+ integration_id=_integration.id,
34
+ )
35
+ assert_that(setting, is_not(none()))
36
+ assert_that(setting.invalid or False, is_(False))
37
+
38
+ codemie_id = vendor_workflow_utils.install_workflow_by_name(
39
+ vendor=vendor_type,
40
+ setting_id=setting.setting_id,
41
+ workflow_name=workflow_name,
42
+ )
43
+ assert_that(codemie_id, is_not(none()))
44
+
45
+ class WorkflowIdWrapper:
46
+ def __init__(self, workflow_id):
47
+ self.id = workflow_id
48
+
49
+ workflow_wrapper = WorkflowIdWrapper(codemie_id)
50
+
51
+ response = workflow_utils.execute_workflow(
52
+ workflow=workflow_wrapper.id,
53
+ execution_name="BedrockFlowNode",
54
+ user_input=user_input,
55
+ )
56
+
57
+ similarity_check.check_similarity(response, expected_response)
58
+
59
+ uninstall_response = vendor_workflow_utils.uninstall_workflow(
60
+ vendor=vendor_type,
61
+ codemie_id=codemie_id,
62
+ )
63
+ assert_that(uninstall_response.success, is_(True))