예제 #1
0
    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)
예제 #2
0
 def test_ok(self):
     app = Application(
         BASE_DIR,
         args_parser.parse_args(
             ['-c',
              os.path.join('conf_files', 'dummy_file'), 'version']),
         self.DUMMY_CONF)
예제 #3
0
 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'
             ]), {})
예제 #4
0
 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'
             ]))
예제 #5
0
    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)
예제 #6
0
 def test_nonexistent_conf_file(self):
     with self.assertRaises(FileNotFoundError):
         app = Application(
             BASE_DIR,
             args_parser.parse_args(
                 ['-c', 'nonexistentpath.json', 'version']))
예제 #7
0
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()