Skip to content

Commit

Permalink
Add additional doc data functionality for update_document
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksiyVeretiuk committed May 21, 2020
1 parent 0ab343d commit 3a40be1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openprocurement_client/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions openprocurement_client/tests/tests_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3a40be1

Please sign in to comment.