From 3a40be108a29d675862bd0cbd66e077e35a4638d Mon Sep 17 00:00:00 2001 From: Oleksiy Veretiuk Date: Thu, 21 May 2020 11:35:03 +0300 Subject: [PATCH] Add additional doc data functionality for update_document --- openprocurement_client/clients.py | 4 ++-- openprocurement_client/tests/tests_resources.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/openprocurement_client/clients.py b/openprocurement_client/clients.py index c3e0d7f..c1d851a 100755 --- a/openprocurement_client/clients.py +++ b/openprocurement_client/clients.py @@ -371,7 +371,7 @@ def patch_document(self, resource_item_id, document_data, document_id, @verify_file def update_document(self, file_, resource_item_id, document_id, subitem_name=DOCUMENTS, doc_type=None, use_ds_client=True, - doc_registration=True, depth_path=None, access_token=None): + doc_registration=True, depth_path=None, access_token=None, additional_doc_data=None): headers = None if access_token: headers = {'X-Access-Token': access_token} @@ -385,7 +385,7 @@ def update_document(self, file_, resource_item_id, document_id, subitem_name=DOC url = '{}/{}/{}/{}'.format(self.prefix_path, resource_item_id, subitem_name, document_id) return self._upload_resource_file(url, file_=file_, headers=headers, method='PUT', use_ds_client=use_ds_client, - doc_registration=doc_registration, doc_type=doc_type) + doc_registration=doc_registration, doc_type=doc_type, additional_doc_data=additional_doc_data) ########################################################################### # UPLOAD CLIENT METHODS diff --git a/openprocurement_client/tests/tests_resources.py b/openprocurement_client/tests/tests_resources.py index 095cc9f..ec93860 100644 --- a/openprocurement_client/tests/tests_resources.py +++ b/openprocurement_client/tests/tests_resources.py @@ -922,6 +922,21 @@ def test_update_tender_document(self): ) self.assertEqual(doc.data.title, file_.name) + def test_update_tender_document_with_additional_doc_data(self): + setup_routing(self.app, routes=["tender_document_update"]) + file_ = StringIO() + file_.name = 'test_document.txt' + file_.write("test upload tender document text data") + file_.seek(0) + doc_data = {'documentOf': 'documents', 'relatedItem': '1'}, + doc = self.client.update_document( + file_, self.limited_tender, + TEST_TENDER_KEYS_LIMITED.document_id, + doc_type='tenderNotice', + additional_doc_data=doc_data + ) + self.assertEqual(doc.data.title, file_.name) + def test_update_bid_document(self): setup_routing(self.app, routes=["tender_subpage_document_update"]) file_ = StringIO()