def test_not_a_dir(self): conf = copy.copy(self.DUMMY_CONF) conf['temp_dir'] = 'nonexistentdir' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf) conf = copy.copy(self.DUMMY_CONF) conf['out_dir'] = 'nonexistentdir' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf) conf = copy.copy(self.DUMMY_CONF) conf['log_dir'] = 'nonexistentdir' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf)
def test_ok(self): app = Application( BASE_DIR, args_parser.parse_args( ['-c', os.path.join('conf_files', 'dummy_file'), 'version']), self.DUMMY_CONF)
def test_missing_conf_parameters(self): with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), {})
def test_not_a_json_conf(self): with self.assertRaises(json.decoder.JSONDecodeError): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'notajsonconf.json'), 'version' ]))
def test_not_a_file(self): conf = copy.copy(self.DUMMY_CONF) conf['ffmpeg_path'] = 'nonexistentfile' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf) conf = copy.copy(self.DUMMY_CONF) conf['ffprobe_path'] = 'nonexistentfile' with self.assertRaises(ConfigurationException): app = Application( BASE_DIR, args_parser.parse_args([ '-c', os.path.join('conf_files', 'dummy_file'), 'version' ]), conf)
def test_nonexistent_conf_file(self): with self.assertRaises(FileNotFoundError): app = Application( BASE_DIR, args_parser.parse_args( ['-c', 'nonexistentpath.json', 'version']))
import os from args_parser import args_parser import application from pyffwrapper import factory, profile_loader from pyffwrapper.profile_data_provider import JinjaProfileDataProvider from pyffwrapper.profile_data_parser import JsonProfileDataParser if __name__ == '__main__': base_dir = os.path.dirname(__file__) app = application.Application(base_dir, args_parser.parse_args()) factory.ffmpeg_factory = factory.FFmpegFactory(app.conf['ffmpeg_path'], app.conf['temp_dir']) factory.ffprobe_factory = factory.FFprobeFactory(app.conf['ffprobe_path']) profile_loader.profile_loader = profile_loader.ProfileLoader( JinjaProfileDataProvider(), JsonProfileDataParser()) app.exec()