31 from cubicweb.devtools.testlib import CubicWebTC |
31 from cubicweb.devtools.testlib import CubicWebTC |
32 from cubicweb.utils import json_dumps |
32 from cubicweb.utils import json_dumps |
33 from cubicweb.uilib import rql_for_eid |
33 from cubicweb.uilib import rql_for_eid |
34 from cubicweb.web import INTERNAL_FIELD_VALUE, Redirect, RequestError, RemoteCallFailed |
34 from cubicweb.web import INTERNAL_FIELD_VALUE, Redirect, RequestError, RemoteCallFailed |
35 import cubicweb.server.session |
35 import cubicweb.server.session |
36 from cubicweb.server.session import Transaction as OldTransaction |
36 from cubicweb.server.session import Connection as OldConnection |
37 from cubicweb.entities.authobjs import CWUser |
37 from cubicweb.entities.authobjs import CWUser |
38 from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes |
38 from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes |
39 from cubicweb.web.views.basecontrollers import JSonController, xhtmlize, jsonize |
39 from cubicweb.web.views.basecontrollers import JSonController, xhtmlize, jsonize |
40 from cubicweb.web.views.ajaxcontroller import ajaxfunc, AjaxFunction |
40 from cubicweb.web.views.ajaxcontroller import ajaxfunc, AjaxFunction |
41 import cubicweb.transaction as tx |
41 import cubicweb.transaction as tx |
760 |
760 |
761 |
761 |
762 class UndoControllerTC(CubicWebTC): |
762 class UndoControllerTC(CubicWebTC): |
763 |
763 |
764 def setUp(self): |
764 def setUp(self): |
765 class Transaction(OldTransaction): |
765 class Connection(OldConnection): |
766 """Force undo feature to be turned on in all case""" |
766 """Force undo feature to be turned on in all case""" |
767 undo_actions = property(lambda tx: True, lambda x, y:None) |
767 undo_actions = property(lambda tx: True, lambda x, y:None) |
768 cubicweb.server.session.Transaction = Transaction |
768 cubicweb.server.session.Connection = Connection |
769 super(UndoControllerTC, self).setUp() |
769 super(UndoControllerTC, self).setUp() |
770 |
770 |
771 def tearDown(self): |
771 def tearDown(self): |
772 super(UndoControllerTC, self).tearDown() |
772 super(UndoControllerTC, self).tearDown() |
773 cubicweb.server.session.Transaction = OldTransaction |
773 cubicweb.server.session.Connection = OldConnection |
774 |
774 |
775 |
775 |
776 def setup_database(self): |
776 def setup_database(self): |
777 req = self.request() |
777 req = self.request() |
778 self.toto = self.create_user(req, 'toto', password='toto', groups=('users',), |
778 self.toto = self.create_user(req, 'toto', password='toto', groups=('users',), |