Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 15 additions & 143 deletions docs.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
# -*- coding: utf-8 -*-
import json
import os
from datetime import timedelta, datetime
from datetime import timedelta

from openprocurement.auctions.core.utils import get_now
from openprocurement.auctions.core.tests.base import PrefixedRequestClass
import openprocurement.auctions.lease.tests.base as base_test
from openprocurement.auctions.lease.constants import DEFAULT_PROCUREMENT_METHOD_TYPE_FINANCIAL
from openprocurement.auctions.lease.tests.base import test_auction_data as base_test_auction_data, test_bids, test_financial_bids
from openprocurement.auctions.lease.constants import DEFAULT_PROCUREMENT_METHOD_TYPE_LEASE
from openprocurement.auctions.lease.tests.base import (
test_auction_data as base_test_auction_data, test_bids
)
from openprocurement.auctions.lease.tests.base import test_auction_maximum_data
from openprocurement.auctions.lease.tests.tender import BaseAuctionWebTest
from webtest import TestApp
from openprocurement.auctions.core.utils import (
apply_data_patch, get_now, SANDBOX_MODE
)

now = datetime.now()
now = get_now()

test_auction_data = base_test_auction_data.copy()
test_financial_auction_data = test_auction_data.copy()
test_financial_auction_data["procurementMethodType"] = DEFAULT_PROCUREMENT_METHOD_TYPE_FINANCIAL
test_auction_data["procurementMethodType"] = DEFAULT_PROCUREMENT_METHOD_TYPE_LEASE

bid = {
"data": {
Expand Down Expand Up @@ -187,8 +190,9 @@ def generate_docservice_url(self):
def test_docs_acceleration(self):
# SANDBOX_MODE=TRUE
data = test_auction_data.copy()
data['procurementMethodDetails'] = 'quick, accelerator=1440'
data['submissionMethodDetails'] = 'quick'
if SANDBOX_MODE:
data['procurementMethodDetails'] = 'quick, accelerator=1440'
data['submissionMethodDetails'] = 'quick'
data['mode'] = 'test'
data["auctionPeriod"] = {
"startDate": (now + timedelta(days=12)).isoformat()
Expand Down Expand Up @@ -320,6 +324,8 @@ def test_docs_tutorial(self):
# Uploading documentation
#

self.set_status("active.tendering")

with open('docs/source/tutorial/upload-auction-notice.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/documents?acc_token={}'.format(self.auction_id, owner_token),
{'data': {
Expand Down Expand Up @@ -1236,137 +1242,3 @@ def _test_docs_complaints(self):
response = self.app.get('/auctions/{}/awards'.format(
self.auction_id, award_id))
self.assertEqual(response.status, '200 OK')

def test_docs_fintutorial(self):
request_path = '/auctions?opt_pretty=1'

# Creating auction
#

with open('docs/source/tutorial/finauction-post-attempt-json-data.http', 'w') as self.app.file_obj:
response = self.app.post_json(
'/auctions?opt_pretty=1', {"data": test_financial_auction_data})
self.assertEqual(response.status, '201 Created')

auction = response.json['data']
owner_token = response.json['access']['token']

with open('docs/source/tutorial/blank-finauction-view.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions/{}'.format(auction['id']))
self.assertEqual(response.status, '200 OK')

self.app.get('/auctions')
with open('docs/source/tutorial/initial-finauction-listing.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions')
self.assertEqual(response.status, '200 OK')

self.app.authorization = ('Basic', ('broker', ''))
self.auction_id = auction['id']

# Uploading documentation
#

with open('docs/source/tutorial/upload-finauction-notice.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/documents?acc_token={}'.format(self.auction_id, owner_token),
{'data': {
'title': u'Notice.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
"documentType": "technicalSpecifications",
"description": "technical specification"
}})
self.assertEqual(response.status, '201 Created')

doc_id = response.json["data"]["id"]
with open('docs/source/tutorial/finauction-documents.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions/{}/documents/{}'.format(
self.auction_id, doc_id))
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/finauction-upload-award-criteria.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/documents?acc_token={}'.format(self.auction_id, owner_token),
{'data': {
'title': u'AwardCriteria.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

doc_id = response.json["data"]["id"]

with open('docs/source/tutorial/finauction-documents-2.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions/{}/documents'.format(
self.auction_id))
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/finauction-update-award-criteria.http', 'w') as self.app.file_obj:
response = self.app.put_json('/auctions/{}/documents/{}?acc_token={}'.format(self.auction_id, doc_id, owner_token),
{'data': {
'title': u'AwardCriteria-2.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/finauction-documents-3.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions/{}/documents'.format(
self.auction_id))
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/finauction-adding-vdr.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/documents?acc_token={}'.format(self.auction_id, owner_token),
{'data': {
'title': u'VDR for auction lot',
'url': 'http://virtial-data-room.com/id_of_room',
'documentType': 'virtualDataRoom',
}})
self.assertEqual(response.status, '201 Created')

# Registering bid
#

self.app.authorization = ('Basic', ('broker', ''))
bids_access = {}
with open('docs/source/tutorial/register-finbidder.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/bids'.format(
self.auction_id), {'data': test_financial_bids[0]})
bid1_id = response.json['data']['id']
bids_access[bid1_id] = response.json['access']['token']
self.assertEqual(response.status, '201 Created')

with open('docs/source/tutorial/activate-finbidder.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/auctions/{}/bids/{}?acc_token={}'.format(
self.auction_id, bid1_id, bids_access[bid1_id]), {"data": {"status": "active"}})
self.assertEqual(response.status, '200 OK')

# Proposal Uploading
#

with open('docs/source/tutorial/upload-finbid-financial-license.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/bids/{}/documents?acc_token={}'.format(self.auction_id, bid1_id, bids_access[bid1_id]),
{'data': {
'title': u'FinancialLicense.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
"documentType": "financialLicense",
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/tutorial/finbidder-documents.http', 'w') as self.app.file_obj:
response = self.app.get('/auctions/{}/bids/{}/documents?acc_token={}'.format(
self.auction_id, bid1_id, bids_access[bid1_id]))
self.assertEqual(response.status, '200 OK')

# Second bidder registration
#

with open('docs/source/tutorial/register-2nd-finbidder.http', 'w') as self.app.file_obj:
response = self.app.post_json('/auctions/{}/bids'.format(
self.auction_id), {'data': test_financial_bids[1]})
bid2_id = response.json['data']['id']
bids_access[bid2_id] = response.json['access']['token']
self.assertEqual(response.status, '201 Created')
4 changes: 4 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.1.1-sale
----------


0.1dev (unreleased)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/source/award_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Award Workflow
==============

For a more detailed information see :ref:`award`
For a more detailed information see :ref:`Award`

* :ref:`Qualification`
* :ref:`Confirming_qualification`
Expand Down
21 changes: 11 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
# openprocurement.auctions.dgf documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 1 02:29:13 2014.
# openprocurement.auctions.lease documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 1 02:29:13 2014;
# manually modified in May 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
Expand Down Expand Up @@ -31,7 +32,7 @@
# ones.
import cornice
extensions = [
'cornice.ext.sphinxext',
# 'cornice.ext.sphinxext', disabled due to import error
'sphinx.ext.intersphinx',
'sphinx.ext.graphviz',
'sphinxcontrib.httpdomain',
Expand All @@ -50,8 +51,8 @@
master_doc = 'index'

# General information about the project.
project = u'openprocurement.auctions.dgf'
copyright = u'2016, Quintagroup, Ltd'
project = u'openprocurement.auctions.lease'
copyright = u'2018, Quintagroup, Ltd'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -183,7 +184,7 @@
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'openprocurementauctionsdgfdoc'
htmlhelp_basename = 'openprocurementauctionsleasedoc'


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -203,7 +204,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'openprocurementauctionsdgf.tex', u'openprocurement.auctions.dgf Documentation',
('index', 'openprocurementauctionslease.tex', u'openprocurement.auctions.lease Documentation',
u'Myroslav Opyr', 'manual'),
]

Expand Down Expand Up @@ -233,7 +234,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'openprocurementauctionsdgf', u'openprocurement.auctions.dgf Documentation',
('index', 'openprocurementauctionslease', u'openprocurement.auctions.lease Documentation',
[u'Myroslav Opyr'], 1)
]

Expand All @@ -247,8 +248,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'openprocurementauctionsdgf', u'openprocurement.auctions.dgf Documentation',
u'Myroslav Opyr', 'openprocurementauctionsdgf', 'One line description of project.',
('index', 'openprocurementauctionslease', u'openprocurement.auctions.lease Documentation',
u'Myroslav Opyr', 'openprocurementauctionslease', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
Loading