equal
deleted
inserted
replaced
1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Fake objects to ease testing of cubicweb without a fully working environment |
18 """Fake objects to ease testing of cubicweb without a fully working environment |
19 """ |
19 """ |
20 |
20 |
21 __docformat__ = "restructuredtext en" |
21 __docformat__ = "restructuredtext en" |
|
22 |
|
23 from contextlib import contextmanager |
22 |
24 |
23 from logilab.database import get_db_helper |
25 from logilab.database import get_db_helper |
24 |
26 |
25 from cubicweb.req import RequestSessionBase |
27 from cubicweb.req import RequestSessionBase |
26 from cubicweb.cwvreg import CWRegistryStore |
28 from cubicweb.cwvreg import CWRegistryStore |
157 return FakeCM() |
159 return FakeCM() |
158 |
160 |
159 # for use with enabled_security context manager |
161 # for use with enabled_security context manager |
160 read_security = write_security = True |
162 read_security = write_security = True |
161 |
163 |
|
164 @contextmanager |
|
165 def running_hooks_ops(self): |
|
166 yield |
|
167 |
162 class FakeRepo(object): |
168 class FakeRepo(object): |
163 querier = None |
169 querier = None |
164 def __init__(self, schema, vreg=None, config=None): |
170 def __init__(self, schema, vreg=None, config=None): |
165 self.extids = {} |
171 self.extids = {} |
166 self.eids = {} |
172 self.eids = {} |