Skip to content

Commit e3e04bd

Browse files
author
kirill.novinskiy@aspose.com
committed
added compare tests
1 parent 83c719f commit e3e04bd

File tree

3 files changed

+60
-86
lines changed

3 files changed

+60
-86
lines changed

asposepdfcloud/apis/pdf_api.py

Lines changed: 36 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11676,7 +11676,7 @@ def get_markdown_in_storage_to_pdf_with_http_info(self, src_path, **kwargs):
1167611676
_request_timeout=params.get('_request_timeout'),
1167711677
collection_formats=collection_formats)
1167811678

11679-
def get_mht_in_storage_to_pdf(self, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs):
11679+
def get_mht_in_storage_to_pdf(self, src_path, **kwargs):
1168011680
"""
1168111681
Convert MHT file (located on storage) to PDF format and return resulting file in response.
1168211682
This method makes a synchronous HTTP request by default. To make an
@@ -11685,30 +11685,30 @@ def get_mht_in_storage_to_pdf(self, src_path, height, width, margin_left, margin
1168511685
>>> def callback_function(response):
1168611686
>>> pprint(response)
1168711687
>>>
11688-
>>> thread = api.get_mht_in_storage_to_pdf(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, callback=callback_function)
11688+
>>> thread = api.get_mht_in_storage_to_pdf(src_path, callback=callback_function)
1168911689

1169011690
:param callback function: The callback function
1169111691
for asynchronous request. (optional)
1169211692
:param str src_path: Full source filename (ex. /folder1/folder2/template.mht) (required)
11693-
:param float height: Page height (required)
11694-
:param float width: Page width (required)
11695-
:param float margin_left: Page margin left (required)
11696-
:param float margin_bottom: Page margin bottom (required)
11697-
:param float margin_right: Page margin right (required)
11698-
:param float margin_top: Page margin top (required)
11693+
:param float height: Page height
11694+
:param float width: Page width
11695+
:param float margin_left: Page margin left
11696+
:param float margin_bottom: Page margin bottom
11697+
:param float margin_right: Page margin right
11698+
:param float margin_top: Page margin top
1169911699
:param str storage: The document storage.
1170011700
:return: file
1170111701
If the method is called asynchronously,
1170211702
returns the request thread.
1170311703
"""
1170411704
kwargs['_return_http_data_only'] = True
1170511705
if kwargs.get('callback'):
11706-
return self.get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs)
11706+
return self.get_mht_in_storage_to_pdf_with_http_info(src_path, **kwargs)
1170711707
else:
11708-
(data) = self.get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs)
11708+
(data) = self.get_mht_in_storage_to_pdf_with_http_info(src_path, **kwargs)
1170911709
return data
1171011710

11711-
def get_mht_in_storage_to_pdf_with_http_info(self, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs):
11711+
def get_mht_in_storage_to_pdf_with_http_info(self, src_path, **kwargs):
1171211712
"""
1171311713
Convert MHT file (located on storage) to PDF format and return resulting file in response.
1171411714
This method makes a synchronous HTTP request by default. To make an
@@ -11717,17 +11717,17 @@ def get_mht_in_storage_to_pdf_with_http_info(self, src_path, height, width, marg
1171711717
>>> def callback_function(response):
1171811718
>>> pprint(response)
1171911719
>>>
11720-
>>> thread = api.get_mht_in_storage_to_pdf_with_http_info(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, callback=callback_function)
11720+
>>> thread = api.get_mht_in_storage_to_pdf_with_http_info(src_path, callback=callback_function)
1172111721

1172211722
:param callback function: The callback function
1172311723
for asynchronous request. (optional)
1172411724
:param str src_path: Full source filename (ex. /folder1/folder2/template.mht) (required)
11725-
:param float height: Page height (required)
11726-
:param float width: Page width (required)
11727-
:param float margin_left: Page margin left (required)
11728-
:param float margin_bottom: Page margin bottom (required)
11729-
:param float margin_right: Page margin right (required)
11730-
:param float margin_top: Page margin top (required)
11725+
:param float height: Page height
11726+
:param float width: Page width
11727+
:param float margin_left: Page margin left
11728+
:param float margin_bottom: Page margin bottom
11729+
:param float margin_right: Page margin right
11730+
:param float margin_top: Page margin top
1173111731
:param str storage: The document storage.
1173211732
:return: file
1173311733
If the method is called asynchronously,
@@ -11752,24 +11752,6 @@ def get_mht_in_storage_to_pdf_with_http_info(self, src_path, height, width, marg
1175211752
# verify the required parameter 'src_path' is set
1175311753
if ('src_path' not in params) or (params['src_path'] is None):
1175411754
raise ValueError("Missing the required parameter `src_path` when calling `get_mht_in_storage_to_pdf`")
11755-
# verify the required parameter 'height' is set
11756-
if ('height' not in params) or (params['height'] is None):
11757-
raise ValueError("Missing the required parameter `height` when calling `get_mht_in_storage_to_pdf`")
11758-
# verify the required parameter 'width' is set
11759-
if ('width' not in params) or (params['width'] is None):
11760-
raise ValueError("Missing the required parameter `width` when calling `get_mht_in_storage_to_pdf`")
11761-
# verify the required parameter 'margin_left' is set
11762-
if ('margin_left' not in params) or (params['margin_left'] is None):
11763-
raise ValueError("Missing the required parameter `margin_left` when calling `get_mht_in_storage_to_pdf`")
11764-
# verify the required parameter 'margin_bottom' is set
11765-
if ('margin_bottom' not in params) or (params['margin_bottom'] is None):
11766-
raise ValueError("Missing the required parameter `margin_bottom` when calling `get_mht_in_storage_to_pdf`")
11767-
# verify the required parameter 'margin_right' is set
11768-
if ('margin_right' not in params) or (params['margin_right'] is None):
11769-
raise ValueError("Missing the required parameter `margin_right` when calling `get_mht_in_storage_to_pdf`")
11770-
# verify the required parameter 'margin_top' is set
11771-
if ('margin_top' not in params) or (params['margin_top'] is None):
11772-
raise ValueError("Missing the required parameter `margin_top` when calling `get_mht_in_storage_to_pdf`")
1177311755

1177411756

1177511757
collection_formats = {}
@@ -36836,7 +36818,7 @@ def put_merge_documents_with_http_info(self, name, merge_documents, **kwargs):
3683636818
_request_timeout=params.get('_request_timeout'),
3683736819
collection_formats=collection_formats)
3683836820

36839-
def put_mht_in_storage_to_pdf(self, name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs):
36821+
def put_mht_in_storage_to_pdf(self, name, src_path, **kwargs):
3684036822
"""
3684136823
Convert MHT file (located on storage) to PDF format and upload resulting file to storage.
3684236824
This method makes a synchronous HTTP request by default. To make an
@@ -36845,18 +36827,18 @@ def put_mht_in_storage_to_pdf(self, name, src_path, height, width, margin_left,
3684536827
>>> def callback_function(response):
3684636828
>>> pprint(response)
3684736829
>>>
36848-
>>> thread = api.put_mht_in_storage_to_pdf(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, callback=callback_function)
36830+
>>> thread = api.put_mht_in_storage_to_pdf(name, src_path, callback=callback_function)
3684936831

3685036832
:param callback function: The callback function
3685136833
for asynchronous request. (optional)
3685236834
:param str name: The document name. (required)
3685336835
:param str src_path: Full source filename (ex. /folder1/folder2/template.mht) (required)
36854-
:param float height: Page height (required)
36855-
:param float width: Page width (required)
36856-
:param float margin_left: Page margin left (required)
36857-
:param float margin_bottom: Page margin bottom (required)
36858-
:param float margin_right: Page margin right (required)
36859-
:param float margin_top: Page margin top (required)
36836+
:param float height: Page height
36837+
:param float width: Page width
36838+
:param float margin_left: Page margin left
36839+
:param float margin_bottom: Page margin bottom
36840+
:param float margin_right: Page margin right
36841+
:param float margin_top: Page margin top
3686036842
:param str dst_folder: The destination document folder.
3686136843
:param str storage: The document storage.
3686236844
:return: AsposeResponse
@@ -36865,12 +36847,12 @@ def put_mht_in_storage_to_pdf(self, name, src_path, height, width, margin_left,
3686536847
"""
3686636848
kwargs['_return_http_data_only'] = True
3686736849
if kwargs.get('callback'):
36868-
return self.put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs)
36850+
return self.put_mht_in_storage_to_pdf_with_http_info(name, src_path, **kwargs)
3686936851
else:
36870-
(data) = self.put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs)
36852+
(data) = self.put_mht_in_storage_to_pdf_with_http_info(name, src_path, **kwargs)
3687136853
return data
3687236854

36873-
def put_mht_in_storage_to_pdf_with_http_info(self, name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, **kwargs):
36855+
def put_mht_in_storage_to_pdf_with_http_info(self, name, src_path, **kwargs):
3687436856
"""
3687536857
Convert MHT file (located on storage) to PDF format and upload resulting file to storage.
3687636858
This method makes a synchronous HTTP request by default. To make an
@@ -36879,18 +36861,18 @@ def put_mht_in_storage_to_pdf_with_http_info(self, name, src_path, height, width
3687936861
>>> def callback_function(response):
3688036862
>>> pprint(response)
3688136863
>>>
36882-
>>> thread = api.put_mht_in_storage_to_pdf_with_http_info(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, callback=callback_function)
36864+
>>> thread = api.put_mht_in_storage_to_pdf_with_http_info(name, src_path, callback=callback_function)
3688336865

3688436866
:param callback function: The callback function
3688536867
for asynchronous request. (optional)
3688636868
:param str name: The document name. (required)
3688736869
:param str src_path: Full source filename (ex. /folder1/folder2/template.mht) (required)
36888-
:param float height: Page height (required)
36889-
:param float width: Page width (required)
36890-
:param float margin_left: Page margin left (required)
36891-
:param float margin_bottom: Page margin bottom (required)
36892-
:param float margin_right: Page margin right (required)
36893-
:param float margin_top: Page margin top (required)
36870+
:param float height: Page height
36871+
:param float width: Page width
36872+
:param float margin_left: Page margin left
36873+
:param float margin_bottom: Page margin bottom
36874+
:param float margin_right: Page margin right
36875+
:param float margin_top: Page margin top
3689436876
:param str dst_folder: The destination document folder.
3689536877
:param str storage: The document storage.
3689636878
:return: AsposeResponse
@@ -36919,24 +36901,6 @@ def put_mht_in_storage_to_pdf_with_http_info(self, name, src_path, height, width
3691936901
# verify the required parameter 'src_path' is set
3692036902
if ('src_path' not in params) or (params['src_path'] is None):
3692136903
raise ValueError("Missing the required parameter `src_path` when calling `put_mht_in_storage_to_pdf`")
36922-
# verify the required parameter 'height' is set
36923-
if ('height' not in params) or (params['height'] is None):
36924-
raise ValueError("Missing the required parameter `height` when calling `put_mht_in_storage_to_pdf`")
36925-
# verify the required parameter 'width' is set
36926-
if ('width' not in params) or (params['width'] is None):
36927-
raise ValueError("Missing the required parameter `width` when calling `put_mht_in_storage_to_pdf`")
36928-
# verify the required parameter 'margin_left' is set
36929-
if ('margin_left' not in params) or (params['margin_left'] is None):
36930-
raise ValueError("Missing the required parameter `margin_left` when calling `put_mht_in_storage_to_pdf`")
36931-
# verify the required parameter 'margin_bottom' is set
36932-
if ('margin_bottom' not in params) or (params['margin_bottom'] is None):
36933-
raise ValueError("Missing the required parameter `margin_bottom` when calling `put_mht_in_storage_to_pdf`")
36934-
# verify the required parameter 'margin_right' is set
36935-
if ('margin_right' not in params) or (params['margin_right'] is None):
36936-
raise ValueError("Missing the required parameter `margin_right` when calling `put_mht_in_storage_to_pdf`")
36937-
# verify the required parameter 'margin_top' is set
36938-
if ('margin_top' not in params) or (params['margin_top'] is None):
36939-
raise ValueError("Missing the required parameter `margin_top` when calling `put_mht_in_storage_to_pdf`")
3694036904

3694136905

3694236906
collection_formats = {}

docs/PdfApi.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,7 @@ Name | Type | Description | Notes
28552855
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
28562856

28572857
# **get_mht_in_storage_to_pdf**
2858-
> file get_mht_in_storage_to_pdf(src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, storage=storage)
2858+
> file get_mht_in_storage_to_pdf(src_path, height=height, width=width, margin_left=margin_left, margin_bottom=margin_bottom, margin_right=margin_right, margin_top=margin_top, storage=storage)
28592859
28602860
Convert MHT file (located on storage) to PDF format and return resulting file in response.
28612861

@@ -2864,12 +2864,12 @@ Convert MHT file (located on storage) to PDF format and return resulting file in
28642864
Name | Type | Description | Notes
28652865
------------- | ------------- | ------------- | -------------
28662866
**src_path** | **str**| Full source filename (ex. /folder1/folder2/template.mht) |
2867-
**height** | **float**| Page height |
2868-
**width** | **float**| Page width |
2869-
**margin_left** | **float**| Page margin left |
2870-
**margin_bottom** | **float**| Page margin bottom |
2871-
**margin_right** | **float**| Page margin right |
2872-
**margin_top** | **float**| Page margin top |
2867+
**height** | **float**| Page height | [optional]
2868+
**width** | **float**| Page width | [optional]
2869+
**margin_left** | **float**| Page margin left | [optional]
2870+
**margin_bottom** | **float**| Page margin bottom | [optional]
2871+
**margin_right** | **float**| Page margin right | [optional]
2872+
**margin_top** | **float**| Page margin top | [optional]
28732873
**storage** | **str**| The document storage. | [optional]
28742874

28752875
### Return type
@@ -8153,7 +8153,7 @@ Name | Type | Description | Notes
81538153
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
81548154

81558155
# **put_mht_in_storage_to_pdf**
8156-
> AsposeResponse put_mht_in_storage_to_pdf(name, src_path, height, width, margin_left, margin_bottom, margin_right, margin_top, dst_folder=dst_folder, storage=storage)
8156+
> AsposeResponse put_mht_in_storage_to_pdf(name, src_path, height=height, width=width, margin_left=margin_left, margin_bottom=margin_bottom, margin_right=margin_right, margin_top=margin_top, dst_folder=dst_folder, storage=storage)
81578157
81588158
Convert MHT file (located on storage) to PDF format and upload resulting file to storage.
81598159

@@ -8163,12 +8163,12 @@ Name | Type | Description | Notes
81638163
------------- | ------------- | ------------- | -------------
81648164
**name** | **str**| The document name. |
81658165
**src_path** | **str**| Full source filename (ex. /folder1/folder2/template.mht) |
8166-
**height** | **float**| Page height |
8167-
**width** | **float**| Page width |
8168-
**margin_left** | **float**| Page margin left |
8169-
**margin_bottom** | **float**| Page margin bottom |
8170-
**margin_right** | **float**| Page margin right |
8171-
**margin_top** | **float**| Page margin top |
8166+
**height** | **float**| Page height | [optional]
8167+
**width** | **float**| Page width | [optional]
8168+
**margin_left** | **float**| Page margin left | [optional]
8169+
**margin_bottom** | **float**| Page margin bottom | [optional]
8170+
**margin_right** | **float**| Page margin right | [optional]
8171+
**margin_top** | **float**| Page margin top | [optional]
81728172
**dst_folder** | **str**| The destination document folder. | [optional]
81738173
**storage** | **str**| The document storage. | [optional]
81748174

test/pdf_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5752,5 +5752,15 @@ def testPostXmpMetadata(self):
57525752
response = self.pdf_api.get_xmp_metadata_json(file_name, folder=self.temp_folder)
57535753
self.assertEqual(9, len(response.properties))
57545754

5755+
def testPostComparePdf(self):
5756+
file_name_1 = '4pages.pdf'
5757+
self.uploadFile(file_name_1)
5758+
file_name_2 = '4pagesPdfA.pdf'
5759+
self.uploadFile(file_name_2)
5760+
output = 'output.pdf'
5761+
5762+
response = self.pdf_api.post_compare_pdf(self.temp_folder + '/' + file_name_1, self.temp_folder + '/' + file_name_2, output)
5763+
self.assertEqual(response.code, 200)
5764+
57555765
if __name__ == '__main__':
57565766
unittest.main()

0 commit comments

Comments
 (0)