def test_it_should_parse_migrations_dir_with_mixed_relative_and_absolute_dirs(self): dirs = Config._parse_migrations_dir('%s:%s:%s:%s' % ('/tmp/test', '.', './a/relative/path', os.path.abspath('another/path'))) self.assertEqual(4, len(dirs)) self.assertEqual('/tmp/test', dirs[0]) self.assertEqual(os.path.abspath('.'), dirs[1]) self.assertEqual(os.path.abspath('./a/relative/path'), dirs[2]) self.assertEqual(os.path.abspath('another/path'), dirs[3])
def test_it_should_parse_migrations_dir_with_multiple_relative_dirs(self): dirs = Config._parse_migrations_dir('test:migrations:./a/relative/path:another/path') self.assertEqual(4, len(dirs)) self.assertEqual(os.path.abspath('test'), dirs[0]) self.assertEqual(os.path.abspath('migrations'), dirs[1]) self.assertEqual(os.path.abspath('./a/relative/path'), dirs[2]) self.assertEqual(os.path.abspath('another/path'), dirs[3])
def test_it_should_parse_migrations_dir_with_relative_dirs_using_config_dir_parameter_as_base_path(self): dirs = Config._parse_migrations_dir( '%s:%s:%s:%s' % ('/tmp/test', '.', './a/relative/path', os.path.abspath('another/path')), config_dir='/base/path_to_relative_dirs' ) self.assertEqual(4, len(dirs)) self.assertEqual('/tmp/test', dirs[0]) self.assertEqual('/base/path_to_relative_dirs', dirs[1]) self.assertEqual('/base/path_to_relative_dirs/a/relative/path', dirs[2]) self.assertEqual(os.path.abspath('another/path'), dirs[3])
def test_it_should_parse_migrations_dir_with_one_relative_dir(self): dirs = Config._parse_migrations_dir('.') self.assertEqual(1, len(dirs)) self.assertEqual(os.path.abspath('.'), dirs[0])