Skip to content

Commit

Permalink
Merge pull request #45 from Scandie/a565404995871133_refactoring_api
Browse files Browse the repository at this point in the history
A565404995871133 refactoring api
  • Loading branch information
leits committed Mar 27, 2018
2 parents 9416e81 + 79bba6e commit c05763a
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cache:
directories:
- eggs
before_install:
- pip install setuptools==7.0
- pip install setuptools==38.5.0
- python2 bootstrap.py
install:
- bin/buildout -N
Expand Down
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ eggs =


[sources]
openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=a499878011598746_separating_awarding
openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=ea_core_master
openprocurement.auctions.core = git https://github.com/openprocurement/openprocurement.auctions.core.git branch=a499878011598746_separating_awarding
44 changes: 25 additions & 19 deletions openprocurement/auctions/flash/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
timedelta,
time
)
from pyramid.security import Allow

from couchdb_schematics.document import SchematicsDocument
from pyramid.security import Allow
from schematics.exceptions import ValidationError
from schematics.transforms import (
whitelist,
blacklist
)
from schematics.types import (
Expand All @@ -24,25 +24,26 @@
DictType,
)
from schematics.types.serializable import serializable
from barbecue import vnmax
from zope.interface import implementer

from barbecue import vnmax

from openprocurement.api.constants import (
SANDBOX_MODE,
AUCTIONS_COMPLAINT_STAND_STILL_TIME
)
from openprocurement.api.interfaces import (
IAwardingNextCheck
)
from openprocurement.api.models import (
IsoDateTimeType,
ListType,
Model,
Value,
PeriodEndRequired,
SANDBOX_MODE,
Organization,
Parameter,
validate_parameters_uniq,
LotValue,
Bid,
Revision,
Question,
Cancellation,
Feature,
Lot,
schematics_embedded_role,
schematics_default_role,
validate_features_uniq,
Expand All @@ -53,12 +54,10 @@
get_now,
ComplaintModelType
)
from openprocurement.api.interfaces import (
IAwardingNextCheck
)
from openprocurement.api.utils import (
get_request_from_root
)

from openprocurement.auctions.core.models import (
IAuction,
get_auction,
Expand All @@ -68,8 +67,15 @@
flash_auction_roles,
flash_bid_roles,
calc_auction_end_time,
COMPLAINT_STAND_STILL_TIME
Parameter,
Organization,
validate_parameters_uniq,
LotValue,
Bid,
Question,
Lot,
)

from openprocurement.auctions.core.plugins.awarding.v1.models import (
Award
)
Expand Down Expand Up @@ -475,15 +481,15 @@ def next_check(self):
from openprocurement.api.utils import calculate_business_date
for complaint in self.complaints:
if complaint.status == 'claim' and complaint.dateSubmitted:
checks.append(calculate_business_date(complaint.dateSubmitted, COMPLAINT_STAND_STILL_TIME, self))
checks.append(calculate_business_date(complaint.dateSubmitted, AUCTIONS_COMPLAINT_STAND_STILL_TIME, self))
elif complaint.status == 'answered' and complaint.dateAnswered:
checks.append(calculate_business_date(complaint.dateAnswered, COMPLAINT_STAND_STILL_TIME, self))
checks.append(calculate_business_date(complaint.dateAnswered, AUCTIONS_COMPLAINT_STAND_STILL_TIME, self))
for award in self.awards:
for complaint in award.complaints:
if complaint.status == 'claim' and complaint.dateSubmitted:
checks.append(calculate_business_date(complaint.dateSubmitted, COMPLAINT_STAND_STILL_TIME, self))
checks.append(calculate_business_date(complaint.dateSubmitted, AUCTIONS_COMPLAINT_STAND_STILL_TIME, self))
elif complaint.status == 'answered' and complaint.dateAnswered:
checks.append(calculate_business_date(complaint.dateAnswered, COMPLAINT_STAND_STILL_TIME, self))
checks.append(calculate_business_date(complaint.dateAnswered, AUCTIONS_COMPLAINT_STAND_STILL_TIME, self))
return min(checks).isoformat() if checks else None

def validate_procurementMethodDetails(self, *args, **kw):
Expand Down
13 changes: 6 additions & 7 deletions openprocurement/auctions/flash/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# -*- coding: utf-8 -*-
import unittest
import webtest
import os
import webtest
from base64 import b64encode
from copy import deepcopy
from datetime import datetime, timedelta
from uuid import uuid4
from requests.models import Response
from base64 import b64encode
from urllib import urlencode
from uuid import uuid4

from openprocurement.api.constants import VERSION, SESSION, SANDBOX_MODE
from openprocurement.api.utils import apply_data_patch

from openprocurement.api.models import SANDBOX_MODE
from openprocurement.api.utils import VERSION, SESSION, apply_data_patch
from openprocurement.api.design import sync_design
from openprocurement.auctions.core.tests.base import BaseWebTest as CoreBaseWebTest


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_auction_bidder_invalid(self):
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['status'], 'error')
self.assertEqual(response.json['errors'], [
{u'description': u'Expecting value: line 1 column 1 (char 0)',
{u'description': u'No JSON object could be decoded',
u'location': u'body', u'name': u'data'}
])

Expand Down
5 changes: 3 additions & 2 deletions openprocurement/auctions/flash/tests/blanks/tender_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from copy import deepcopy
from datetime import timedelta

from openprocurement.api.models import get_now, SANDBOX_MODE
from openprocurement.api.models import get_now
from openprocurement.api.constants import SANDBOX_MODE

from openprocurement.auctions.flash.models import Auction
from openprocurement.auctions.flash.tests.base import test_auction_data, test_organization
Expand Down Expand Up @@ -61,7 +62,7 @@ def create_auction_invalid(self):
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['status'], 'error')
self.assertEqual(response.json['errors'], [
{u'description': u'Expecting value: line 1 column 1 (char 0)',
{u'description': u'No JSON object could be decoded',
u'location': u'body', u'name': u'data'}
])

Expand Down
7 changes: 4 additions & 3 deletions openprocurement/auctions/flash/views/auction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from openprocurement.api.utils import (
json_view,
context_unpack,
cleanup_bids_for_cancelled_lots,
APIResource,
APIResource
)

from openprocurement.auctions.core.utils import (
save_auction,
apply_patch,
opresource
opresource,
cleanup_bids_for_cancelled_lots
)
from openprocurement.auctions.core.validation import (
validate_auction_auction_data,
Expand Down
7 changes: 5 additions & 2 deletions openprocurement/auctions/flash/views/bid_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
APIResource,
)
from openprocurement.api.validation import (
validate_file_update,
validate_file_upload,
validate_patch_document_data,
)

from openprocurement.auctions.core.utils import (
save_auction,
apply_patch,
opresource,
)
from openprocurement.auctions.core.validation import (
validate_file_update,
validate_file_upload,
)


@opresource(name='belowThreshold:Auction Bid Documents',
Expand Down
9 changes: 6 additions & 3 deletions openprocurement/auctions/flash/views/cancellation_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
APIResource,
)
from openprocurement.api.validation import (
validate_file_update,
validate_file_upload,
validate_patch_document_data,
validate_patch_document_data
)

from openprocurement.auctions.core.utils import (
save_auction,
apply_patch,
opresource,
)
from openprocurement.auctions.core.validation import (
validate_file_update,
validate_file_upload,
)


@opresource(name='belowThreshold:Auction Cancellation Documents',
Expand Down
9 changes: 6 additions & 3 deletions openprocurement/auctions/flash/views/complaint_document.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from openprocurement.api.constants import STATUS4ROLE
from openprocurement.api.utils import (
get_file,
upload_file,
Expand All @@ -9,15 +8,19 @@
APIResource,
)
from openprocurement.api.validation import (
validate_file_update,
validate_file_upload,
validate_patch_document_data,
)

from openprocurement.auctions.core.constants import STATUS4ROLE
from openprocurement.auctions.core.utils import (
save_auction,
apply_patch,
opresource,
)
from openprocurement.auctions.core.validation import (
validate_file_update,
validate_file_upload,
)


@opresource(name='belowThreshold:Auction Complaint Documents',
Expand Down
7 changes: 5 additions & 2 deletions openprocurement/auctions/flash/views/tender_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
APIResource,
)
from openprocurement.api.validation import (
validate_file_update,
validate_file_upload,
validate_patch_document_data,
)

from openprocurement.auctions.core.utils import (
save_auction,
apply_patch,
opresource,
)
from openprocurement.auctions.core.validation import (
validate_file_update,
validate_file_upload,
)


@opresource(name='belowThreshold:Auction Documents',
Expand Down
6 changes: 3 additions & 3 deletions versions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ MarkupSafe = 0.23
PasteDeploy = 1.5.2
Pygments = 2.0.2
Sphinx = 1.3.1
WebOb = 1.6.1
WebOb = 1.7
WebTest = 2.0.20
docutils = 0.12
jsonpointer = 1.9
nose = 1.3.7
py = 1.4.26
pyramid = 1.7
pyramid = 1.9
python-coveralls = 2.5.0
repoze.lru = 0.6
translationstring = 1.3
Expand Down Expand Up @@ -48,7 +48,7 @@ chaussette = 1.2

# Required by:
# openprocurement.api==0.8.1
cornice = 1.2.0.dev0
cornice = 3.1.0

# Required by:
# openprocurement.api==0.8.1
Expand Down

0 comments on commit c05763a

Please sign in to comment.