Skip to content

Commit

Permalink
mock config for testing (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmotso authored and leits committed Jun 19, 2018
1 parent a6c132a commit d67ef6e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 65 deletions.
32 changes: 0 additions & 32 deletions openprocurement/auctions/dgf/tests/app_meta.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions openprocurement/auctions/dgf/tests/auth.ini

This file was deleted.

16 changes: 14 additions & 2 deletions openprocurement/auctions/dgf/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
DEFAULT_PROCUREMENT_METHOD_TYPE_FINANCIAL
)

from openprocurement.auctions.dgf.tests.fixtures import PARTIAL_MOCK_CONFIG
from openprocurement.auctions.core.tests.base import MOCK_CONFIG as BASE_MOCK_CONFIG
from openprocurement.auctions.core.utils import connection_mock_config


now = datetime.now()
test_auction_data['procurementMethodType'] = DEFAULT_PROCUREMENT_METHOD_TYPE_OTHER
if SANDBOX_MODE:
Expand Down Expand Up @@ -161,6 +166,12 @@
test_financial_auction_data_with_schema['items'][0]['schema_properties'] = schema_properties


MOCK_CONFIG = connection_mock_config(PARTIAL_MOCK_CONFIG,
base=BASE_MOCK_CONFIG,
connector=('plugins', 'api', 'plugins',
'auctions.core', 'plugins'))


class BaseWebTest(CoreBaseWebTest):

"""Base Web Test to test openprocurement.auctions.dgf.
Expand All @@ -169,13 +180,15 @@ class BaseWebTest(CoreBaseWebTest):
"""

relative_to = os.path.dirname(__file__)
mock_config = MOCK_CONFIG


class BaseAuctionWebTest(CoreBaseAuctionWebTest):
relative_to = os.path.dirname(__file__)
initial_data = test_auction_data
initial_organization = test_organization
registry = False
mock_config = MOCK_CONFIG

def create_auction(self):
data = deepcopy(self.initial_data)
Expand All @@ -198,8 +211,7 @@ def create_auction(self):
self.auction_id = auction['id']
authorization = self.app.authorization
self.app.authorization = ('Basic', ('convoy', ''))
response = self.app.patch_json('/auctions/{}'.format(self.auction_id),
{'data': {'items': items, 'status': 'active.tendering'}})
response = self.app.patch_json('/auctions/{}'.format(self.auction_id), {'data': {'items': items, 'status': 'active.tendering'}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
auction = response.json['data']
Expand Down
19 changes: 19 additions & 0 deletions openprocurement/auctions/dgf/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
)
from openprocurement.auctions.core.utils import get_now

PARTIAL_MOCK_CONFIG = {
"auctions.dgf.financial":{
"use_default":True,
"plugins":{
"dgf.financial.migration":None
},
"migration":False,
"aliases":[]
},
"auctions.dgf.other":{
"use_default":True,
"plugins":{
"dgf.other.migration":None
},
"migration":False,
"aliases":[]
}
}

PROLONGATION = {
'decisionID': 'very_importante_documente',
'description': 'Prolongate your contract for free!',
Expand Down

0 comments on commit d67ef6e

Please sign in to comment.