15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """unit tests for schema rql (de)serialization""" |
18 """unit tests for schema rql (de)serialization""" |
19 |
19 |
|
20 from logilab.database import get_db_helper |
|
21 |
|
22 from yams import register_base_type, unregister_base_type |
|
23 |
20 from cubicweb import Binary |
24 from cubicweb import Binary |
21 from cubicweb.schema import CubicWebSchemaLoader |
25 from cubicweb.schema import CubicWebSchemaLoader |
22 from cubicweb.devtools import TestServerConfiguration |
26 from cubicweb.devtools import TestServerConfiguration |
23 from cubicweb.devtools.testlib import BaseTestCase as TestCase, CubicWebTC |
27 from cubicweb.devtools.testlib import BaseTestCase as TestCase, CubicWebTC |
24 |
|
25 from cubicweb.server.schemaserial import (updateeschema2rql, updaterschema2rql, rschema2rql, |
28 from cubicweb.server.schemaserial import (updateeschema2rql, updaterschema2rql, rschema2rql, |
26 eschema2rql, rdef2rql, specialize2rql, |
29 eschema2rql, rdef2rql, specialize2rql, |
27 _erperms2rql as erperms2rql) |
30 _erperms2rql as erperms2rql) |
28 |
31 |
29 from logilab.database import get_db_helper |
|
30 from yams import register_base_type, unregister_base_type |
|
31 |
32 |
32 schema = config = None |
33 schema = config = None |
|
34 |
33 def setUpModule(*args): |
35 def setUpModule(*args): |
34 register_base_type('BabarTestType', ('jungle_speed',)) |
36 register_base_type('BabarTestType', ('jungle_speed',)) |
35 helper = get_db_helper('sqlite') |
37 helper = get_db_helper('sqlite') |
36 helper.TYPE_MAPPING['BabarTestType'] = 'TEXT' |
38 helper.TYPE_MAPPING['BabarTestType'] = 'TEXT' |
37 helper.TYPE_CONVERTERS['BabarTestType'] = lambda x: '"%s"' % x |
39 helper.TYPE_CONVERTERS['BabarTestType'] = lambda x: '"%s"' % x |