Beispiel #1
0
    def test_base_encoder(self):
        """
        Basic tests for the BaseEncoder and getting the output file name.
        """

        from html5video.encoders.base import BaseEncoder

        encoder = BaseEncoder('fake_file.mov')

        self.assertEqual('fake_file.avi', encoder.get_output_path('avi'))
Beispiel #2
0
    def test_dimensions(self):

        from html5video.encoders.base import BaseEncoder

        e = BaseEncoder('fake_file.mov')

        self.assertEqual(e.dimensions, None)

        e.dimensions = "100x200"

        self.assertEqual(e.width, "100")
        self.assertEqual(e.height, "200")
        self.assertEqual(e.dimensions, "100x200")

        with self.assertRaises(AttributeError):
            e.dimensions = None
Beispiel #3
0
    def test_path_calculations(self):

        from html5video.encoders.base import BaseEncoder

        test_cases = (
            # No output specified
            ('/my/video2.mov', None, '/my/video2.mp4'),
            # Output is a directory
            ('/my/video1.mov', '/tmp/', '/tmp/video1.mp4'),
            # Output is a specific file path
            ('/my/video3.mov', '/tmp/out3', '/tmp/out3.mp4'),
        )

        for source, in_path, out_path in test_cases:

            e = BaseEncoder(source, in_path)
            self.assertEquals(e.get_output_path('mp4'), out_path)