Commit 28f21119 authored by Aurelien Campeas's avatar Aurelien Campeas
Browse files

[session] fix super call in Connection.__init__

The vile hacks in test fixtures are fixed.
parent 2fe2077cc92d
......@@ -254,8 +254,7 @@ class Connection(RequestSessionBase):
is_repo_in_memory = True # bw compat
def __init__(self, session):
# using super(Connection, self) confuse some test hack
RequestSessionBase.__init__(self, session.vreg)
super(Connection, self).__init__(session.repo.vreg)
#: connection unique id
self._open = None
self.connectionid = '%s-%s' % (session.sessionid, uuid4().hex)
......
......@@ -21,8 +21,7 @@ from six import text_type
from cubicweb import ValidationError
from cubicweb.devtools.testlib import CubicWebTC
import cubicweb.server.session
from cubicweb.server.session import Connection as OldConnection
from cubicweb.server.session import Connection
from cubicweb.server.sources.native import UndoTransactionException, _UndoException
......@@ -42,15 +41,13 @@ class UndoableTransactionTC(CubicWebTC):
return cnx.entity_from_eid(self.totoeid)
def setUp(self):
class Connection(OldConnection):
"""Force undo feature to be turned on in all case"""
undo_actions = property(lambda tx: True, lambda x, y:None)
cubicweb.server.session.Connection = Connection
# Force undo feature to be turned on
Connection.undo_actions = property(lambda self: True, lambda self, v:None)
super(UndoableTransactionTC, self).setUp()
def tearDown(self):
cubicweb.server.session.Connection = OldConnection
super(UndoableTransactionTC, self).tearDown()
del Connection.undo_actions
def check_transaction_deleted(self, cnx, txuuid):
# also check transaction actions have been properly deleted
......
......@@ -33,7 +33,7 @@ from cubicweb.utils import json_dumps
from cubicweb.uilib import rql_for_eid
from cubicweb.web import Redirect, RemoteCallFailed
import cubicweb.server.session
from cubicweb.server.session import Connection as OldConnection
from cubicweb.server.session import Connection
from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes
from cubicweb.web.views.basecontrollers import JSonController, xhtmlize, jsonize
from cubicweb.web.views.ajaxcontroller import ajaxfunc, AjaxFunction
......@@ -1013,15 +1013,13 @@ class JSonControllerTC(AjaxControllerTC):
class UndoControllerTC(CubicWebTC):
def setUp(self):
class Connection(OldConnection):
"""Force undo feature to be turned on in all case"""
undo_actions = property(lambda tx: True, lambda x, y:None)
cubicweb.server.session.Connection = Connection
# Force undo feature to be turned on
Connection.undo_actions = property(lambda self: True, lambda self, v:None)
super(UndoControllerTC, self).setUp()
def tearDown(self):
super(UndoControllerTC, self).tearDown()
cubicweb.server.session.Connection = OldConnection
del Connection.undo_actions
def setup_database(self):
with self.admin_access.repo_cnx() as cnx:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment