Skip to content

Commit 64dd2a4

Browse files
tests: treat import-form-data responses as multi-input (input_ids)
1 parent db03096 commit 64dd2a4

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

tests/live/test_live_import_form_data.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ def test_live_import_form_data(
6565
assert response.output_files
6666
output_file = response.output_file
6767
assert output_file.type == "application/pdf"
68-
assert str(response.input_id) == str(uploaded_pdf_with_forms.id)
68+
assert str(uploaded_pdf_with_forms.id) in {
69+
str(file_id) for file_id in response.input_ids
70+
}
71+
assert str(uploaded_form_data_file.id) in {
72+
str(file_id) for file_id in response.input_ids
73+
}
6974
if output_name is not None:
7075
assert output_file.name.startswith(output_name)
7176
else:
@@ -93,7 +98,12 @@ async def test_live_async_import_form_data_success(
9398
output_file = response.output_file
9499
assert output_file.name.startswith("async-imported")
95100
assert output_file.type == "application/pdf"
96-
assert str(response.input_id) == str(uploaded_pdf_with_forms.id)
101+
assert str(uploaded_pdf_with_forms.id) in {
102+
str(file_id) for file_id in response.input_ids
103+
}
104+
assert str(uploaded_form_data_file.id) in {
105+
str(file_id) for file_id in response.input_ids
106+
}
97107

98108

99109
def test_live_import_form_data_invalid_data_file_id(

tests/test_import_form_data.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def handler(request: httpx.Request) -> httpx.Response:
4949
return httpx.Response(
5050
200,
5151
json={
52-
"inputId": [input_file.id],
52+
"inputId": [input_file.id, data_file.id],
5353
"outputId": [output_id],
5454
},
5555
)
@@ -79,7 +79,8 @@ def handler(request: httpx.Request) -> httpx.Response:
7979
assert isinstance(response, PdfRestFileBasedResponse)
8080
assert response.output_file.name == "filled-form.pdf"
8181
assert response.output_file.type == "application/pdf"
82-
assert str(response.input_id) == str(input_file.id)
82+
assert str(input_file.id) in {str(file_id) for file_id in response.input_ids}
83+
assert str(data_file.id) in {str(file_id) for file_id in response.input_ids}
8384
assert response.warning is None
8485

8586

@@ -108,7 +109,7 @@ def handler(request: httpx.Request) -> httpx.Response:
108109
return httpx.Response(
109110
200,
110111
json={
111-
"inputId": [input_file.id],
112+
"inputId": [input_file.id, data_file.id],
112113
"outputId": [output_id],
113114
},
114115
)
@@ -177,7 +178,7 @@ def handler(request: httpx.Request) -> httpx.Response:
177178
return httpx.Response(
178179
200,
179180
json={
180-
"inputId": [input_file.id],
181+
"inputId": [input_file.id, data_file.id],
181182
"outputId": [output_id],
182183
},
183184
)
@@ -203,7 +204,8 @@ def handler(request: httpx.Request) -> httpx.Response:
203204
assert isinstance(response, PdfRestFileBasedResponse)
204205
assert response.output_file.name == "async.pdf"
205206
assert response.output_file.type == "application/pdf"
206-
assert str(response.input_id) == str(input_file.id)
207+
assert str(input_file.id) in {str(file_id) for file_id in response.input_ids}
208+
assert str(data_file.id) in {str(file_id) for file_id in response.input_ids}
207209

208210

209211
@pytest.mark.asyncio

0 commit comments

Comments
 (0)