Skip to content

Commit c5f74f0

Browse files
committed
[document-conversion] Fixes unit tests
This commit includes updated fixes for the document conversion unit tests.
1 parent 0de97a5 commit c5f74f0

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

test/test_document_conversion_v1.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ def test_success():
1818
content_type='application/json')
1919

2020
with open(os.path.join(os.path.dirname(__file__), '../resources/simple.html'), 'r') as document:
21-
config = {'conversion_target': watson_developer_cloud.DocumentConversionV1.NORMALIZED_HTML}
22-
document_conversion.convert_document(
23-
document=document, config=config, media_type='text/html')
21+
convertConfig = {'conversion_target': watson_developer_cloud.DocumentConversionV1.NORMALIZED_HTML}
22+
document_conversion.convert_document(document=document, config=convertConfig, media_type='text/html')
2423

25-
assert responses.calls[
26-
1].request.url == convert_url
27-
assert responses.calls[1].response.text == convert_response
28-
29-
assert len(responses.calls) == 2
24+
assert responses.calls[0].request.url == convert_url
25+
assert responses.calls[0].response.text == convert_response
3026

3127
index_url = 'https://gateway.watsonplatform.net/document-conversion/api/v1/index_document'
3228
index_response = '{"status": "success"}'
@@ -35,20 +31,18 @@ def test_success():
3531
body=index_response, status=200,
3632
content_type='application/json')
3733

38-
with open(os.path.join(os.path.dirname(__file__), '../resources/simple.html'), 'r') as document:
39-
config = {
34+
with open(os.path.join(os.path.dirname(__file__), '../resources/example.html'), 'r') as document:
35+
indexConfig = {
4036
'retrieve_and_rank': {
4137
'dry_run':'false',
4238
'service_instance_id':'serviceInstanceId',
4339
'cluster_id':'clusterId',
4440
'search_collection':'searchCollectionName'
4541
}
4642
}
47-
document_conversion.index_document(
48-
config=config, document=document)
43+
document_conversion.index_document(config=indexConfig, document=document)
4944

50-
assert responses.calls[
51-
1].request.url == index_url
45+
assert responses.calls[1].request.url == index_url
5246
assert responses.calls[1].response.text == index_response
5347

5448
assert len(responses.calls) == 2

0 commit comments

Comments
 (0)