Skip to content

Commit a8a65cc

Browse files
committed
test: corrected some tests
1 parent 66aae84 commit a8a65cc

File tree

3 files changed

+26
-35
lines changed

3 files changed

+26
-35
lines changed

_test_contract/platform_api/test_destinations.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
from unstructured_client import UnstructuredClient
66
from unstructured_client.models import shared, operations
77
from unstructured_client.models.errors import SDKError
8-
from unstructured_client.models.shared import (
9-
DestinationConnectorInformationConfig,
10-
DestinationConnectorType,
11-
Config,
12-
UpdateDestinationConnectorConfig,
13-
)
8+
from unstructured_client.models.shared import DestinationConnectorType
9+
1410

1511

1612
def test_list_destinations(
@@ -49,7 +45,7 @@ def test_list_destinations(
4945
assert destination.id == "0c363dec-3c70-45ee-8041-481044a6e1cc"
5046
assert destination.name == "test_destination_name"
5147
assert destination.type == "s3"
52-
assert destination.config == DestinationConnectorInformationConfig()
48+
assert destination.config == {}
5349
assert destination.created_at == datetime.fromisoformat(
5450
"2025-08-22T08:47:29.802+00:00"
5551
)
@@ -142,7 +138,7 @@ def test_get_destination(httpx_mock, client: UnstructuredClient, platform_api_ur
142138
assert destination.id == "0c363dec-3c70-45ee-8041-481044a6e1cc"
143139
assert destination.name == "test_destination_name"
144140
assert destination.type == "s3"
145-
assert destination.config == DestinationConnectorInformationConfig()
141+
assert destination.config == {}
146142
assert destination.created_at == datetime.fromisoformat(
147143
"2025-08-22T08:47:29.802+00:00"
148144
)
@@ -194,7 +190,7 @@ def test_create_destination(
194190
create_destination_connector=shared.CreateDestinationConnector(
195191
name="test_destination_name",
196192
type=DestinationConnectorType.S3,
197-
config=Config(),
193+
config={},
198194
)
199195
)
200196
)
@@ -210,7 +206,7 @@ def test_create_destination(
210206
assert destination.id == "b25d4161-77a0-4e08-b65e-86f398ce15ad"
211207
assert destination.name == "test_destination_name"
212208
assert destination.type == "s3"
213-
assert destination.config == DestinationConnectorInformationConfig()
209+
assert destination.config == {}
214210
assert destination.created_at == datetime.fromisoformat(
215211
"2023-09-15T01:06:53.146+00:00"
216212
)
@@ -238,7 +234,7 @@ def test_update_destination(
238234
request=operations.UpdateDestinationRequest(
239235
destination_id="1",
240236
update_destination_connector=shared.UpdateDestinationConnector(
241-
config=UpdateDestinationConnectorConfig()
237+
config={}
242238
),
243239
)
244240
)
@@ -255,7 +251,7 @@ def test_update_destination(
255251
assert updated_destination.id == "b25d4161-77a0-4e08-b65e-86f398ce15ad"
256252
assert updated_destination.name == "test_destination_name"
257253
assert updated_destination.type == "s3"
258-
assert updated_destination.config == DestinationConnectorInformationConfig()
254+
assert updated_destination.config == {}
259255
assert updated_destination.created_at == datetime.fromisoformat(
260256
"2023-09-15T01:06:53.146+00:00"
261257
)

_test_contract/platform_api/test_sources.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
from unstructured_client import UnstructuredClient
77
from unstructured_client.models import shared, operations
88
from unstructured_client.models.errors import SDKError
9-
from unstructured_client.models.shared import (
10-
SourceConnectorInformationConfig,
11-
SourceConnectorType,
12-
CreateSourceConnectorConfig,
13-
UpdateSourceConnectorConfig,
14-
)
9+
from unstructured_client.models.shared import SourceConnectorType
1510

1611

1712
class AsyncMock(mock.MagicMock):
@@ -53,7 +48,7 @@ def test_list_sources(httpx_mock, client: UnstructuredClient, platform_api_url:
5348
assert source.id == "a15d4161-77a0-4e08-b65e-86f398ce15ad"
5449
assert source.name == "test_source_name"
5550
assert source.type == "onedrive"
56-
assert source.config == SourceConnectorInformationConfig()
51+
assert source.config == {}
5752
assert source.created_at == datetime.fromisoformat("2023-09-15T01:06:53.146+00:00")
5853

5954

@@ -142,7 +137,7 @@ def test_get_source(httpx_mock, client: UnstructuredClient, platform_api_url: st
142137
assert source.id == "a15d4161-77a0-4e08-b65e-86f398ce15ad"
143138
assert source.name == "test_source_name"
144139
assert source.type == "onedrive"
145-
assert source.config == SourceConnectorInformationConfig()
140+
assert source.config == {}
146141
assert source.created_at == datetime.fromisoformat("2023-09-15T01:06:53.146+00:00")
147142

148143

@@ -188,7 +183,7 @@ def test_create_source(httpx_mock, client: UnstructuredClient, platform_api_url:
188183
create_source_connector=shared.CreateSourceConnector(
189184
name="test_source_name",
190185
type=SourceConnectorType.ONEDRIVE,
191-
config=CreateSourceConnectorConfig(),
186+
config={},
192187
)
193188
)
194189
)
@@ -204,7 +199,7 @@ def test_create_source(httpx_mock, client: UnstructuredClient, platform_api_url:
204199
assert source.id == "a15d4161-77a0-4e08-b65e-86f398ce15ad"
205200
assert source.name == "test_source_name"
206201
assert source.type == "onedrive"
207-
assert source.config == SourceConnectorInformationConfig()
202+
assert source.config == {}
208203
assert source.created_at == datetime.fromisoformat("2023-09-15T01:06:53.146+00:00")
209204

210205

@@ -229,7 +224,7 @@ def test_update_source(httpx_mock, client: UnstructuredClient, platform_api_url:
229224
request=operations.UpdateSourceRequest(
230225
source_id="1",
231226
update_source_connector=shared.UpdateSourceConnector(
232-
config=UpdateSourceConnectorConfig()
227+
config={}
233228
),
234229
)
235230
)
@@ -246,7 +241,7 @@ def test_update_source(httpx_mock, client: UnstructuredClient, platform_api_url:
246241
assert updated_source.id == "a15d4161-77a0-4e08-b65e-86f398ce15ad"
247242
assert updated_source.name == "test_source_name"
248243
assert updated_source.type == "onedrive"
249-
assert updated_source.config == SourceConnectorInformationConfig()
244+
assert updated_source.config == {}
250245
assert updated_source.created_at == datetime.fromisoformat(
251246
"2023-09-15T01:06:53.146+00:00"
252247
)

_test_contract/platform_api/test_workflows.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_list_workflows(httpx_mock, client: UnstructuredClient, platform_api_url
2121
],
2222
"id": "16b80fee-64dc-472d-8f26-1d7729b6423d",
2323
"name": "test_workflow",
24-
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * *"}]},
24+
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * 0"}]},
2525
"sources": [
2626
"f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c",
2727
],
@@ -53,7 +53,7 @@ def test_list_workflows(httpx_mock, client: UnstructuredClient, platform_api_url
5353
"2025-06-22T11:37:21.648+00:00"
5454
)
5555
assert workflow.schedule == shared.WorkflowSchedule(
56-
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * *")]
56+
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * 0")]
5757
)
5858

5959
assert workflow.sources == [
@@ -127,7 +127,7 @@ def test_create_workflow(httpx_mock, client: UnstructuredClient, platform_api_ur
127127
],
128128
"id": "16b80fee-64dc-472d-8f26-1d7729b6423d",
129129
"name": "test_workflow",
130-
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * *"}]},
130+
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * 0"}]},
131131
"sources": [
132132
"f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c",
133133
],
@@ -141,7 +141,7 @@ def test_create_workflow(httpx_mock, client: UnstructuredClient, platform_api_ur
141141
create_workflow=shared.CreateWorkflow(
142142
name="test_workflow",
143143
workflow_type="advanced",
144-
schedule="0 0 * * *",
144+
schedule="weekly",
145145
source_id="f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c",
146146
destination_id="aeebecc7-9d8e-4625-bf1d-815c2f084869",
147147
)
@@ -171,7 +171,7 @@ def test_update_workflow(httpx_mock, client: UnstructuredClient, platform_api_ur
171171
],
172172
"id": "16b80fee-64dc-472d-8f26-1d7729b6423d",
173173
"name": "test_workflow",
174-
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * *"}]},
174+
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * 0"}]},
175175
"sources": [
176176
"f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c",
177177
],
@@ -186,7 +186,7 @@ def test_update_workflow(httpx_mock, client: UnstructuredClient, platform_api_ur
186186
update_workflow=shared.UpdateWorkflow(
187187
name="test_workflow",
188188
workflow_type="advanced",
189-
schedule="0 0 * * *",
189+
schedule="weekly",
190190
source_id="f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c",
191191
destination_id="aeebecc7-9d8e-4625-bf1d-815c2f084869",
192192
),
@@ -210,7 +210,7 @@ def test_update_workflow(httpx_mock, client: UnstructuredClient, platform_api_ur
210210
"2025-06-22T11:37:21.648+00:00"
211211
)
212212
assert updated_workflow.schedule == shared.WorkflowSchedule(
213-
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * *")]
213+
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * 0")]
214214
)
215215
assert updated_workflow.sources == ["f1f7b1b2-8e4b-4a2b-8f1d-3e3c7c9e5a3c"]
216216
assert updated_workflow.destinations == ["aeebecc7-9d8e-4625-bf1d-815c2f084869"]
@@ -229,12 +229,12 @@ def test_run_workflow(httpx_mock, client: UnstructuredClient, platform_api_url:
229229
"created_at": "2024-08-04T10:06:22.481Z",
230230
"id": "6c4f327c-7ca2-4933-a68d-2ebe9d9f1445",
231231
"name": "test_workflow",
232-
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * *"}]},
232+
"schedule": {"crontab_entries": [{"cron_expression": "0 0 * * 0"}]},
233233
"sources": ["a9593964-92eb-496f-84ac-c8f067ba24c3"],
234234
"destinations": [
235235
"aeebecc7-9d8e-4625-bf1d-815c2f084869",
236236
],
237-
"status": "inactive",
237+
"status": "active",
238238
"workflow_type": "platinum",
239239
},
240240
)
@@ -257,12 +257,12 @@ def test_run_workflow(httpx_mock, client: UnstructuredClient, platform_api_url:
257257
assert workflow_run.id == "6c4f327c-7ca2-4933-a68d-2ebe9d9f1445"
258258
assert workflow_run.name == "test_workflow"
259259
assert workflow_run.workflow_type == "platinum"
260-
assert workflow_run.status == "inactive"
260+
assert workflow_run.status == "active"
261261
assert workflow_run.created_at == datetime.fromisoformat(
262262
"2024-08-04T10:06:22.481+00:00"
263263
)
264264
assert workflow_run.schedule == shared.WorkflowSchedule(
265-
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * *")]
265+
crontab_entries=[shared.crontabentry.CronTabEntry(cron_expression="0 0 * * 0")]
266266
)
267267
assert workflow_run.sources == ["a9593964-92eb-496f-84ac-c8f067ba24c3"]
268268
assert workflow_run.destinations == ["aeebecc7-9d8e-4625-bf1d-815c2f084869"]

0 commit comments

Comments
 (0)