41 def cube_migration_scripts_dir(cls, cube): |
41 def cube_migration_scripts_dir(cls, cube): |
42 return TMIGRDIR |
42 return TMIGRDIR |
43 |
43 |
44 class MigrationToolsTC(TestCase): |
44 class MigrationToolsTC(TestCase): |
45 def setUp(self): |
45 def setUp(self): |
46 self.config = MigrTestConfig('data') |
46 self.config = MigrTestConfig('data', __file__) |
47 from yams.schema import Schema |
47 from yams.schema import Schema |
48 self.config.load_schema = lambda expand_cubes=False: Schema('test') |
48 self.config.load_schema = lambda expand_cubes=False: Schema('test') |
49 self.config.__class__.cubicweb_appobject_path = frozenset() |
49 self.config.__class__.cubicweb_appobject_path = frozenset() |
50 self.config.__class__.cube_appobject_path = frozenset() |
50 self.config.__class__.cube_appobject_path = frozenset() |
51 |
51 |
72 self.assertListEqual(filter_scripts(self.config, TMIGRDIR, (0,0,2), (0,0,4)), |
72 self.assertListEqual(filter_scripts(self.config, TMIGRDIR, (0,0,2), (0,0,4)), |
73 [((0, 0, 3), TMIGRDIR+'0.0.3_Any.py'), |
73 [((0, 0, 3), TMIGRDIR+'0.0.3_Any.py'), |
74 ((0, 0, 4), TMIGRDIR+'0.0.4_Any.py')]) |
74 ((0, 0, 4), TMIGRDIR+'0.0.4_Any.py')]) |
75 |
75 |
76 def test_filter_scripts_for_mode(self): |
76 def test_filter_scripts_for_mode(self): |
77 config = CubicWebConfiguration('data') |
77 config = CubicWebConfiguration('data', __file__) |
78 config.verbosity = 0 |
78 config.verbosity = 0 |
79 config = self.config |
79 config = self.config |
80 config.__class__.name = 'repository' |
80 config.__class__.name = 'repository' |
81 self.assertListEqual(filter_scripts(config, TMIGRDIR, (0,0,4), (0,1,0)), |
81 self.assertListEqual(filter_scripts(config, TMIGRDIR, (0,0,4), (0,1,0)), |
82 [((0, 1 ,0), TMIGRDIR+'0.1.0_Any.py'), |
82 [((0, 1 ,0), TMIGRDIR+'0.1.0_Any.py'), |
98 |
98 |
99 class BaseCreationTC(TestCase): |
99 class BaseCreationTC(TestCase): |
100 |
100 |
101 def test_db_creation(self): |
101 def test_db_creation(self): |
102 """make sure database can be created""" |
102 """make sure database can be created""" |
103 config = ApptestConfiguration('data', apphome=self.datadir) |
103 config = ApptestConfiguration('data', __file__) |
104 source = config.system_source_config |
104 source = config.system_source_config |
105 self.assertEqual(source['db-driver'], 'sqlite') |
105 self.assertEqual(source['db-driver'], 'sqlite') |
106 handler = get_test_db_handler(config) |
106 handler = get_test_db_handler(config) |
107 handler.init_test_database() |
107 handler.init_test_database() |
108 handler.build_db_cache() |
108 handler.build_db_cache() |