Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/multi_lots' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Oct 3, 2016
2 parents e82a20e + fdb67ec commit 8d241ce
Show file tree
Hide file tree
Showing 31 changed files with 3,892 additions and 763 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
omit =
*tests*
*docs.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise NotImplementedError
if __name__ == .__main__.:
104 changes: 103 additions & 1 deletion docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@
test_tender_negotiation_quick_data['causeDescription_en'] = "original tender has failed twice"
test_tender_negotiation_quick_data['causeDescription_ru'] = "оригинальный тендер не получился дважды"


test_lots = [
{
'title': 'Лот №1',
'description': 'Опис Лот №1',
'value': test_tender_negotiation_data['value'],
}
]


class DumpsTestAppwebtest(TestApp):

def do_request(self, req, status=None, expect_errors=None):
Expand Down Expand Up @@ -452,7 +462,8 @@ def test_docs(self):

with open('docs/source/tutorial/tender-negotiation-award-approve.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/tenders/{}/awards/{}?acc_token={}'.format(
self.tender_id, self.award_id, owner_token), {'data': {'status': 'active'}})
self.tender_id, self.award_id, owner_token), {'data': {'status': 'active',
'qualified': True}})
self.assertEqual(response.status, '200 OK')

# get contract
Expand All @@ -473,6 +484,97 @@ def test_docs(self):
self.tender_id, self.contract_id, owner_token), {'data': {'status': 'active'}})
self.assertEqual(response.status, '200 OK')

def test_multiple_lots(self):
request_path = '/tenders?opt_pretty=1'

#### Exploring basic rules
#

with open('docs/source/multiple_lots_tutorial/tender-listing.http', 'w') as self.app.file_obj:
self.app.authorization = None
response = self.app.get(request_path)
self.assertEqual(response.status, '200 OK')
self.app.file_obj.write("\n")

#### Creating tender
#
self.app.authorization = ('Basic', ('broker', ''))
with open('docs/source/multiple_lots_tutorial/tender-post-attempt-json-data.http', 'w') as self.app.file_obj:
response = self.app.post_json('/tenders?opt_pretty=1', {'data': self.initial_data})
self.assertEqual(response.status, '201 Created')

tender = response.json['data']
tender_id = self.tender_id = tender['id']
owner_token = response.json['access']['token']

# add lots
with open('docs/source/multiple_lots_tutorial/tender-add-lot.http', 'w') as self.app.file_obj:
response = self.app.post_json('/tenders/{}/lots?acc_token={}'.format(tender_id, owner_token),
{'data': test_lots[0]})
self.assertEqual(response.status, '201 Created')
lot_id1 = response.json['data']['id']

# add relatedLot for item
with open('docs/source/multiple_lots_tutorial/tender-add-relatedLot-to-item.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/tenders/{}?acc_token={}'.format(tender_id, owner_token),
{'data': {'items': [{'relatedLot': lot_id1}]}})
self.assertEqual(response.status, '200 OK')

while True:
with open('docs/source/multiple_lots_tutorial/tender-listing-no-auth.http', 'w') as self.app.file_obj:
self.app.authorization = None
response = self.app.get(request_path)
self.assertEqual(response.status, '200 OK')
if len(response.json['data']):
break

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

#### Adding supplier information
#
self.app.authorization = ('Basic', ('broker', ''))
suspplier_loc = deepcopy(supplier)
suspplier_loc['data']['lotID'] = lot_id1
with open('docs/source/multiple_lots_tutorial/tender-award.http', 'w') as self.app.file_obj:
response = self.app.post_json('/tenders/{}/awards?acc_token={}'.format(tender_id, owner_token),
suspplier_loc)
self.assertEqual(response.status, '201 Created')
self.award_id = response.json['data']['id']

#### Award confirmation

with open('docs/source/multiple_lots_tutorial/tender-award-approve.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/tenders/{}/awards/{}?acc_token={}'.format(
self.tender_id, self.award_id, owner_token), {'data': {'status': 'active',
'qualified': True}})
self.assertEqual(response.status, '200 OK')

# get contract
response = self.app.get('/tenders/{}/contracts?acc_token={}'.format(self.tender_id, owner_token))
self.contract_id = response.json['data'][0]['id']

#### Set contract value

with open('docs/source/multiple_lots_tutorial/tender-contract-set-contract-value.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/tenders/{}/contracts/{}?acc_token={}'.format(
self.tender_id, self.contract_id, owner_token), {"data": {"value": {"amount": 238}}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['value']['amount'], 238)

#### Contract signing

tender = self.db.get(self.tender_id)
for i in tender.get('awards', []):
i['complaintPeriod']['endDate'] = i['complaintPeriod']['startDate']
self.db.save(tender)

with open('docs/source/multiple_lots_tutorial/tender-contract-sign.http', 'w') as self.app.file_obj:
response = self.app.patch_json('/tenders/{}/contracts/{}?acc_token={}'.format(
self.tender_id, self.contract_id, owner_token), {'data': {'status': 'active'}})
self.assertEqual(response.status, '200 OK')


class TenderNegotiationQuickLimitedResourceTest(TenderNegotiationLimitedResourceTest):
initial_data = test_tender_negotiation_quick_data
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Contents:
overview
tutorial
standard/index
multiple_lots_tutorial
complaints
acceleration
reference
Expand Down
6 changes: 3 additions & 3 deletions docs/source/locale/uk/LC_MESSAGES/index.po
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ msgstr ""
msgid "Contents:"
msgstr "Зміст:"

#: ../../source/index.rst:29
#: ../../source/index.rst:30
msgid "Indices and tables"
msgstr "Індекси та таблиці"

#: ../../source/index.rst:31
#: ../../source/index.rst:32
msgid ":ref:`genindex`"
msgstr ":ref:`genindex`"

#: ../../source/index.rst:32
#: ../../source/index.rst:33
msgid ":ref:`search`"
msgstr ":ref:`search`"
122 changes: 122 additions & 0 deletions docs/source/locale/uk/LC_MESSAGES/multiple_lots_tutorial.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#
msgid ""
msgstr ""
"Project-Id-Version: openprocurement.tender.limited 2.3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-12 11:38+0000\n"
"PO-Revision-Date: 2016-09-12 11:38+0000\n"
"Last-Translator: Serbokryl Oleg <chezar1995@com.ua>\n"
"Language-Team: UK <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../source/multiple_lots_tutorial.rst:4
msgid "Multiple Lots Tutorial"
msgstr "Туторіал для багатолотової закупівлі"

#: ../../source/multiple_lots_tutorial.rst:8
msgid "Creating tender"
msgstr "Створення закупівлі"

#: ../../source/multiple_lots_tutorial.rst:10
msgid "Let's create tender:"
msgstr "Створимо закупівлю:"

#: ../../source/multiple_lots_tutorial.rst:15
msgid ""
"Now we can see that new object was created. Response code is `201` and "
"`Location` response header reports the location of the created object. The "
"body of response reveals the information about the created tender: its "
"internal `id` (that matches the `Location` segment), its official `tenderID`"
" and `dateModified` datestamp stating the moment in time when tender was "
"last modified. Note that tender is created with `active.tendering` status."
msgstr ""
"Тепер ми бачимо, що новий об’єкт було створено. Код відповіді - `201`, "
"заголовок відповіді `Location` вказує місцерозташування створеного об’єкта. "
"Тіло відповіді показує інформацію про створену закупівлю, її внутрішнє `id` "
"(яке співпадає з сегментом `Location`), її офіційне `tenderID` та "
"`dateModified` дату, що показує час, коли закупівля востаннє модифікувалась."
" Зверніть увагу, що закупівля створюється зі статусом `active.tendering`."

#: ../../source/multiple_lots_tutorial.rst:22
msgid ""
"Tender can contain several different lots. We can add lot using the "
"following way:"
msgstr ""
"Закіпівля може складатись із декількох лотів. Можна створити лот таким "
"чином:"

#: ../../source/multiple_lots_tutorial.rst:27
msgid "Also you will need to update data about item's related lots:"
msgstr "Потрібно оновити дані пов’язані із залежністю на лот:"

#: ../../source/multiple_lots_tutorial.rst:32
msgid "View tender listing:"
msgstr "Перегляньте список закупівель:"

#: ../../source/multiple_lots_tutorial.rst:37
msgid "or view tender:"
msgstr "або перегляньте окрему закупівлю:"

#: ../../source/multiple_lots_tutorial.rst:44
msgid "Awarding"
msgstr "Визначення переможця"

#: ../../source/multiple_lots_tutorial.rst:46
msgid "Addition of supplier information is the same for all procedures."
msgstr "Спосіб додавання інформації про постачальника однаковий для всіх процедур."

#: ../../source/multiple_lots_tutorial.rst:48
msgid "Add award for lot №1:"
msgstr "Додавання інформації про постачальника для лота №1:"

#: ../../source/multiple_lots_tutorial.rst:53
msgid "Award confirmation:"
msgstr "Підтвердження визначення переможця:"

#: ../../source/multiple_lots_tutorial.rst:58
msgid ""
"The difference between ``startDate`` and ``endDate`` in ``complaintPeriod`` "
"record for **negotiation** is 10 days and for **negotiation.quick** is 5 "
"days."
msgstr ""
"Різниця між початковою (``startDate``) та кінцевою (``endDate``) датою "
"запису ``complaintPeriod`` для **переговорної** процедури становить 10 днів та 5 днів для **переговорної процедури за нагальною "
"потребою** "

#: ../../source/multiple_lots_tutorial.rst:62
msgid "Setting contract value"
msgstr "Встановлення вартості угоди"

#: ../../source/multiple_lots_tutorial.rst:64
msgid ""
"By default contract value is set based on the award, but there is a "
"possibility to set custom contract value."
msgstr ""
"За замовчуванням вартість угоди встановлюється на основі рішення про "
"визначення переможця, але є можливість змінити це значення."

#: ../../source/multiple_lots_tutorial.rst:66
msgid ""
"If you want to **lower contract value**, you can insert new one into the "
"`amount` field."
msgstr ""
"Якщо ви хочете **знизити вартість угоди**, ви можете встановити нове "
"значення для поля `amount`."

#: ../../source/multiple_lots_tutorial.rst:71
msgid "`200 OK` response was returned. The value was modified successfully."
msgstr "Було повернуто код відповіді `200 OK`. Значення змінено успішно."

#: ../../source/multiple_lots_tutorial.rst:75
msgid "Contract registration"
msgstr "Реєстрація угоди"

#: ../../source/multiple_lots_tutorial.rst:77
msgid ""
"**Negotiation** and **Negotiation.quick** tender contract can be registered only after the stand-still (10 and 5 days period after the award confirmation)."
msgstr ""
"Угода про закупівлю за **переговорною** та **переговорної процедури за нагальною потребою** процедурою може бути зареєстрована "
"одразу після `періоду очікування скарг (десятиденний та пятидений період після "
"підтвердження визначення переможця)."
80 changes: 80 additions & 0 deletions docs/source/locale/uk/LC_MESSAGES/standard/lot.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
msgid ""
msgstr ""
"Project-Id-Version: openprocurement.tender.limited 2.3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-12 12:26+0000\n"
"PO-Revision-Date: 2016-09-12 12:12+0000\n"
"Last-Translator: Serbokryl Oleg <chezar1995@gmail.com>\n"
"Language-Team: UK <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../source/standard/lot.rst:9
msgid "Lot"
msgstr "Lot"

#: ../../source/standard/lot.rst:12
msgid "Schema"
msgstr "Схема"

#: ../../source/standard/lot.rst:15
msgid "string, auto-generated"
msgstr "рядок, генерується автоматично"

#: ../../source/standard/lot.rst:18 ../../source/standard/lot.rst:23
msgid "string, multilingual"
msgstr "рядок, багатомовний"

#: ../../source/standard/lot.rst:20
msgid "The name of the tender lot."
msgstr "Назва лота закупівлі."

#: ../../source/standard/lot.rst:25
msgid "Detailed description of tender lot."
msgstr "Детальний опис лота закупівлі."

#: ../../source/standard/lot.rst:28
msgid ":ref:`value`, required"
msgstr ":ref:`value`, обов’язково"

#: ../../source/standard/lot.rst:30
msgid ""
"Total available tender lot budget. Bids greater then ``value`` will be "
"rejected."
msgstr ""
"Повний доступний бюджет лота закупівлі. Цінові пропозиції, більші ніж "
"``value``, будуть відхилені."

#: ../../source/standard/lot.rst:33
msgid "string"
msgstr "рядок"

#: ../../source/standard/lot.rst:36
msgid "Active tender lot"
msgstr "Активний лот закупівлі"

#: ../../source/standard/lot.rst:38
msgid "Unsuccessful tender lot"
msgstr "Неуспішний лот закупівлі"

#: ../../source/standard/lot.rst:40
msgid "Completed tender lot"
msgstr "Завершений лот закупівлі"

#: ../../source/standard/lot.rst:42
msgid "Cancelled tender lot"
msgstr "Відмінений лот закупівлі"

#: ../../source/standard/lot.rst:44
msgid "Status of the Lot."
msgstr "Статус лота."

#: ../../source/standard/lot.rst:47
msgid "Workflow"
msgstr "Схема роботи"

#: ../../source/standard/lot.rst:61
msgid "\\* marks initial state"
msgstr "\\* позначає початковий стан"

0 comments on commit 8d241ce

Please sign in to comment.