示例#1
0
    def test_convert_unsupported_file(self):
        self.set_files({
            '/test/in': ['file1.wav', 'file2.test.wav', 'file3.flac'],
        })
        self.convert_file_mock.side_effect = NotSupportedError()

        # is the exception catched?
        convert_dir('/test/in', '/test/out', '/usr/bin/sox', None)
示例#2
0
    def test_convert_existing_file(self):
        self.set_files({
            '/test/in': ['file1.wav', 'file2.test.wav', 'file3.flac'],
        })
        self.convert_file_mock.side_effect = FileAlreadyExistsError()

        # is the exception catched?
        convert_dir('/test/in', '/test/out', '/usr/bin/sox', None)
示例#3
0
    def test_convert_dir_with_custom_bitrate(self):
        self.set_files({
            '/test/in': ['file1.wav'],
        })

        convert_dir('/test/in', '/test/out', bitrate=42)

        self.convert_file_mock.assert_has_calls([
            call('file1.wav', '/test/in', '/test/out', 'sox', 42),
        ])
示例#4
0
    def test_convert_with_custom_command(self):
        self.set_files({
            '/test/in': ['file1.wav', 'subdir'],
            '/test/in/subdir': ['subfile1.wav'],
        })

        convert_dir('/test/in', '/test/out', '/usr/bin/sox')

        self.convert_file_mock.assert_has_calls([
            call('file1.wav', '/test/in', '/test/out', '/usr/bin/sox', None),
            call('subfile1.wav', '/test/in/subdir', '/test/out/subdir', '/usr/bin/sox', None),
        ])
示例#5
0
    def test_convert_dir(self):
        self.set_files({
            '/test/in': ['file1.wav', 'file2.test.wav', 'file3.flac'],
        })

        convert_dir('/test/in', '/test/out')

        self.convert_file_mock.assert_has_calls([
            call('file1.wav', '/test/in', '/test/out', 'sox', None),
            call('file2.test.wav', '/test/in', '/test/out', 'sox', None),
            call('file3.flac', '/test/in', '/test/out', 'sox', None),
        ])
示例#6
0
    def test_convert_subdir(self):
        self.set_files({
            '/test/in': ['file1.wav', 'subdir'],
            '/test/in/subdir': ['subfile1.wav', 'subfile2.wav'],
        })

        convert_dir('/test/in', '/test/out', '/usr/bin/sox', 42)

        self.convert_file_mock.assert_has_calls([
            call('file1.wav', '/test/in', '/test/out', '/usr/bin/sox', 42),
            call('subfile1.wav', '/test/in/subdir', '/test/out/subdir', '/usr/bin/sox', 42),
            call('subfile2.wav', '/test/in/subdir', '/test/out/subdir', '/usr/bin/sox', 42),
        ])