equal
deleted
inserted
replaced
1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2016 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 |
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 """cubicweb.migration unit tests""" |
18 """cubicweb.migration unit tests""" |
19 |
19 |
20 from os.path import abspath, dirname, join |
20 from os.path import dirname, join |
21 from logilab.common.testlib import TestCase, unittest_main |
21 from logilab.common.testlib import TestCase, unittest_main |
22 |
22 |
23 from cubicweb.devtools import TestServerConfiguration |
23 from cubicweb.devtools import TestServerConfiguration |
24 from cubicweb.cwconfig import CubicWebConfiguration |
24 from cubicweb.cwconfig import CubicWebConfiguration |
25 from cubicweb.migration import MigrationHelper, filter_scripts, version_strictly_lower |
25 from cubicweb.migration import filter_scripts, version_strictly_lower |
26 from cubicweb.server.migractions import ServerMigrationHelper |
|
27 |
26 |
28 |
27 |
29 class Schema(dict): |
28 class Schema(dict): |
30 def has_entity(self, e_type): |
29 def has_entity(self, e_type): |
31 return e_type in self |
30 return e_type in self |
33 SMIGRDIR = join(dirname(__file__), 'data', 'server_migration') + '/' |
32 SMIGRDIR = join(dirname(__file__), 'data', 'server_migration') + '/' |
34 TMIGRDIR = join(dirname(__file__), 'data', 'migration') + '/' |
33 TMIGRDIR = join(dirname(__file__), 'data', 'migration') + '/' |
35 |
34 |
36 class MigrTestConfig(TestServerConfiguration): |
35 class MigrTestConfig(TestServerConfiguration): |
37 verbosity = 0 |
36 verbosity = 0 |
|
37 |
38 def migration_scripts_dir(cls): |
38 def migration_scripts_dir(cls): |
39 return SMIGRDIR |
39 return SMIGRDIR |
40 |
40 |
41 def cube_migration_scripts_dir(cls, cube): |
41 def cube_migration_scripts_dir(cls, cube): |
42 return TMIGRDIR |
42 return TMIGRDIR |