Exemplo n.º 1
0
 def setup(self):
     """Set up test env"""
     setup_once()
     if self.__tmp__:
         self.__tmp__ = util.maketemp() + os.sep
         self.__yaml__ = self.__yaml__.replace("__tmp__", self.__tmp__)
     self.manager = MockManager(self.__yaml__, self.__class__.__name__)
Exemplo n.º 2
0
 def setup(self):
     """Set up test env"""
     setup_once()
     if self.__tmp__:
         self.__tmp__ = util.maketemp() + '/'
         self.__yaml__ = self.__yaml__.replace("__tmp__", self.__tmp__)
     self.manager = MockManager(self.__yaml__, self.__class__.__name__, db_uri=self.database_uri)
Exemplo n.º 3
0
 def setup(self):
     """Set up test env"""
     setup_once()
     if self.__tmp__:
         self.__tmp__ = util.maketemp() + '/'
         self.__yaml__ = self.__yaml__.replace("__tmp__", self.__tmp__)
     self.manager = MockManager(self.__yaml__,
                                self.__class__.__name__,
                                db_uri=self.database_uri)
Exemplo n.º 4
0
 def setup(self):
     FlexGetBase.setup(self)
     # generate config
     self.test_home = maketemp()
     for task_name in self.manager.config['tasks'].iterkeys():
         if isinstance(self.manager.config['tasks'][task_name]['exists_series'], dict):
             self.manager.config['tasks'][task_name]['exists_series']['path'] = self.test_home
         else:
             self.manager.config['tasks'][task_name]['exists_series'] = self.test_home
     # create test dirs
     for dir in self.test_dirs:
         os.mkdir(os.path.join(self.test_home, dir))
Exemplo n.º 5
0
 def setup(self):
     FlexGetBase.setup(self)
     # generate config
     self.test_home = maketemp()
     for task_name in self.manager.config['tasks'].iterkeys():
         if isinstance(self.manager.config['tasks'][task_name]['exists_series'], dict):
             self.manager.config['tasks'][task_name]['exists_series']['path'] = self.test_home
         else:
             self.manager.config['tasks'][task_name]['exists_series'] = self.test_home
     # create test dirs
     for dir in self.test_dirs:
         os.mkdir(os.path.join(self.test_home, dir))
Exemplo n.º 6
0
 def setup(self):
     """Set up test env"""
     setup_once()
     if self.__tmp__:
         self.__tmp__ = util.maketemp() + '/'
         self.__yaml__ = self.__yaml__.replace("__tmp__", self.__tmp__)
     self.manager = MockManager(self.__yaml__, self.__class__.__name__, db_uri=self.database_uri)
     for config_function in self.config_functions:
         config_function(self.manager.config)
     if self.tasks_functions and 'tasks' in self.manager.config:
         for task_name, task_definition in self.manager.config['tasks'].items():
             for task_function in self.tasks_functions:
                 task_function(task_name, task_definition)
Exemplo n.º 7
0
 def setup(self):
     """Set up test env"""
     setup_once()
     if self.__tmp__:
         self.__tmp__ = util.maketemp() + '/'
         self.__yaml__ = self.__yaml__.replace("__tmp__", self.__tmp__)
     self.manager = MockManager(self.__yaml__, self.__class__.__name__, db_uri=self.database_uri)
     for config_function in self.config_functions:
         config_function(self.manager.config)
     if self.tasks_functions and 'tasks' in self.manager.config:
         for task_name, task_definition in self.manager.config['tasks'].items():
             for task_function in self.tasks_functions:
                 task_function(task_name, task_definition)
Exemplo n.º 8
0
 def test_path(self):
     path = validator.factory('path')
     path_allow_missing = validator.factory('path', allow_missing=True)
     temp_path = maketemp()
     path.validate(temp_path)
     print path.errors.messages
     assert not path.errors.messages, '%s should be valid' % (temp_path)
     path_allow_missing.validate('missing_directory')
     print path_allow_missing.errors.messages
     assert not path_allow_missing.errors.messages, 'missing_directory should be valid with allow_missing'
     path.validate('missing_directory')
     print path.errors.messages
     assert path.errors.messages, 'missing_directory should be invalid'
     path_allow_missing.errors.messages = []
Exemplo n.º 9
0
 def test_choice(self):
     path = validator.factory('path')
     path_allow_missing = validator.factory('path', allow_missing=True)
     temp_path = maketemp()
     path.validate(temp_path)
     print path.errors.messages
     assert not path.errors.messages, '%s should be valid' % (temp_path)
     path_allow_missing.validate('missing_directory')
     print path_allow_missing.errors.messages
     assert not path_allow_missing.errors.messages, 'missing_directory should be valid with allow_missing'
     path.validate('missing_directory')
     print path.errors.messages
     assert path.errors.messages, 'missing_directory should be invalid'
     path_allow_missing.errors.messages = []
Exemplo n.º 10
0
 def setup(self):
     FlexGetBase.setup(self)
     # generate config
     self.test_home = maketemp()
     for task_name in self.manager.config['tasks'].iterkeys():
         if isinstance(self.manager.config['tasks'][task_name]['exists_movie'], dict):
             self.manager.config['tasks'][task_name]['exists_movie']['path'] = self.test_home
         else:
             self.manager.config['tasks'][task_name]['exists_movie'] = self.test_home
     # create test dirs
     for test_dir in self.test_dirs:
         os.makedirs(os.path.join(self.test_home, test_dir))
     # create test files
     for test_file in self.test_files:
         open(os.path.join(self.test_home, test_file), 'a').close()
Exemplo n.º 11
0
 def setup(self):
     FlexGetBase.setup(self)
     # generate config
     self.test_home = maketemp()
     for task_name in self.manager.config['tasks'].iterkeys():
         if isinstance(
                 self.manager.config['tasks'][task_name]['exists_movie'],
                 dict):
             self.manager.config['tasks'][task_name]['exists_movie'][
                 'path'] = self.test_home
         else:
             self.manager.config['tasks'][task_name][
                 'exists_movie'] = self.test_home
     # create test dirs
     for test_dir in self.test_dirs:
         os.makedirs(os.path.join(self.test_home, test_dir))
     # create test files
     for test_file in self.test_files:
         open(os.path.join(self.test_home, test_file), 'a').close()