Skip to content

Commit c0bf55f

Browse files
committed
fix tests
1 parent daa5abf commit c0bf55f

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

_test_contract/platform_api/test_templates.py

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,14 @@ def test_list_templates(httpx_mock, platform_client: UnstructuredClient, platfor
1919
"name": "High Resolution Partition",
2020
"description": "Partition documents with high resolution strategy",
2121
"version": "1.0.0",
22-
"nodes": [
23-
{
24-
"id": "93fc2ce8-e7c8-424f-a6aa-41460fc5d35d",
25-
"name": "partition step",
26-
"type": "partition",
27-
"subtype": "unstructured_api",
28-
}
29-
],
30-
"edges": [],
22+
"last_updated": "2024-01-01T00:00:00.000000",
3123
},
3224
{
3325
"id": "hi_res_and_enrichment",
3426
"name": "High Resolution and Enrichment",
3527
"description": "Partition with enrichment",
3628
"version": "1.0.0",
37-
"nodes": [],
38-
"edges": [],
29+
"last_updated": "2024-01-01T00:00:00.000000",
3930
},
4031
],
4132
url=url,
@@ -52,12 +43,12 @@ def test_list_templates(httpx_mock, platform_client: UnstructuredClient, platfor
5243
assert request.method == "GET"
5344
assert request.url == url
5445

55-
assert "templates" in templates_response.response_list_templates
5646
templates = templates_response.response_list_templates
47+
assert templates is not None
5748
assert len(templates) == 2
58-
assert templates[0]["id"] == "hi_res_partition"
59-
assert templates[0]["name"] == "High Resolution Partition"
60-
assert templates[1]["id"] == "hi_res_and_enrichment"
49+
assert templates[0].id == "hi_res_partition"
50+
assert templates[0].name == "High Resolution Partition"
51+
assert templates[1].id == "hi_res_and_enrichment"
6152

6253

6354
def test_get_template(httpx_mock, platform_client: UnstructuredClient, platform_api_url: str):
@@ -71,6 +62,7 @@ def test_get_template(httpx_mock, platform_client: UnstructuredClient, platform_
7162
"name": "High Resolution Partition",
7263
"description": "Partition documents with high resolution strategy",
7364
"version": "1.0.0",
65+
"last_updated": "2024-01-01T00:00:00.000000",
7466
"nodes": [
7567
{
7668
"id": "93fc2ce8-e7c8-424f-a6aa-41460fc5d35d",
@@ -83,12 +75,6 @@ def test_get_template(httpx_mock, platform_client: UnstructuredClient, platform_
8375
},
8476
}
8577
],
86-
"edges": [
87-
{
88-
"source_id": "00000000-0000-0000-0000-000000000001-downloader",
89-
"destination_id": "93fc2ce8-e7c8-424f-a6aa-41460fc5d35d",
90-
}
91-
],
9278
},
9379
url=url,
9480
)
@@ -104,12 +90,12 @@ def test_get_template(httpx_mock, platform_client: UnstructuredClient, platform_
10490
assert request.method == "GET"
10591
assert request.url == url
10692

107-
assert "template" in template_response.response_get_template
108-
template = template_response.response_get_template
109-
assert template["id"] == "hi_res_partition"
110-
assert template["name"] == "High Resolution Partition"
111-
assert len(template["nodes"]) == 1
112-
assert template["nodes"][0]["id"] == "93fc2ce8-e7c8-424f-a6aa-41460fc5d35d"
93+
template = template_response.template_detail
94+
assert template is not None
95+
assert template.id == "hi_res_partition"
96+
assert template.name == "High Resolution Partition"
97+
assert len(template.nodes) == 1
98+
assert template.nodes[0].id == "93fc2ce8-e7c8-424f-a6aa-41460fc5d35d"
11399

114100

115101
def test_get_template_not_found(

0 commit comments

Comments
 (0)