Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed Dec 28, 2017
1 parent de63433 commit 45807ec
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions guillotina/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"debug": False,
"aiohttp_settings": {},
"databases": [],
"storages": {},
"conflict_retry_attempts": 3,
"host": "127.0.0.1",
"port": 8080,
Expand Down
2 changes: 1 addition & 1 deletion guillotina/commands/initialize_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ async def run(self, arguments, settings, app):
for _id, db in root:
if IDatabase.providedBy(db):
print(f'Initializing database: {_id}')
await db._db._storage.create()
await db._storage.create()
2 changes: 1 addition & 1 deletion guillotina/commands/testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_parser(self):

async def generate_test_data(self, db):
# don't slow us down with transactions
db._db._storage._transaction_strategy = 'none'
db._storage._transaction_strategy = 'none'

tm = self.request._tm = db.get_transaction_manager()
self.request._db_id = db.id
Expand Down
2 changes: 1 addition & 1 deletion guillotina/factory/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,4 @@ async def close_utilities(app):
await lazy_apply(utility.finalize, app=app)
for db in root:
if IDatabase.providedBy(db[1]):
await db[1]._db.finalize()
await db[1].finalize()
4 changes: 2 additions & 2 deletions guillotina/factory/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(self, key, storage):
Database object is persistent through the application
"""
self._storage = storage
self._database_name = key
self.id = self._database_name = key
self._tm = None

@property
Expand All @@ -144,7 +144,7 @@ async def initialize(self):
txn.register(root)
commit = True
except KeyError:
from guillotina.db.factory import Root
from guillotina.db.db import Root
root = Root(self._database_name)
txn.register(root, new_oid=ROOT_ID)
commit = True
Expand Down
2 changes: 1 addition & 1 deletion guillotina/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_mocked_request(db=None, method='POST', path='/', headers={}):
alsoProvides(request, IRequest)
alsoProvides(request, IDefaultLayer)
if db is not None:
db._db.request = request
db.request = request
request._db_id = db.id
request._db = db
request._tm = db.get_transaction_manager()
Expand Down
2 changes: 1 addition & 1 deletion guillotina/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async def get_containers(request, transaction_strategy='none'):
for _id, db in root:
if IDatabase.providedBy(db):
if transaction_strategy is not None:
db._db._storage._transaction_strategy = transaction_strategy
db._storage._transaction_strategy = transaction_strategy
tm = request._tm = db.get_transaction_manager()
tm.request = request
request._db_id = _id
Expand Down

0 comments on commit 45807ec

Please sign in to comment.