示例#1
0
    def it_can_construct_from_a_path(self, video_, from_blob_):
        with open(TEST_VIDEO_PATH, "rb") as f:
            blob = f.read()
        from_blob_.return_value = video_

        video = Video.from_path_or_file_like(TEST_VIDEO_PATH, "video/mp4")

        Video.from_blob.assert_called_once_with(blob, "video/mp4", "dummy.mp4")
        assert video is video_
 def _video(self):
     """Return a |Video| object containing the movie file."""
     return Video.from_path_or_file_like(self._movie_file, self._mime_type)
示例#3
0
 def filename_fixture(self, request, ext_prop_):
     filename, ext, expected_value = request.param
     video = Video(None, None, filename)
     ext_prop_.return_value = ext
     return video, expected_value
示例#4
0
 def ext_fixture(self, request):
     mime_type, filename, expected_value = request.param
     video = Video(None, mime_type, filename)
     return video, expected_value
示例#5
0
 def content_type_fixture(self):
     mime_type = "video/mp4"
     video = Video(None, mime_type, None)
     expected_value = mime_type
     return video, expected_value
示例#6
0
 def blob_fixture(self):
     blob = b"blob-bytes"
     video = Video(blob, None, None)
     expected_value = blob
     return video, expected_value
示例#7
0
 def it_can_construct_from_a_blob(self, from_blob_fixture):
     blob, mime_type, filename, Video_init_ = from_blob_fixture
     video = Video.from_blob(blob, mime_type, filename)
     Video_init_.assert_called_once_with(video, blob, mime_type, filename)
     assert isinstance(video, Video)
示例#8
0
 def it_can_construct_from_a_stream(self, from_stream_fixture):
     movie_stream, mime_type, blob, video_ = from_stream_fixture
     video = Video.from_path_or_file_like(movie_stream, mime_type)
     Video.from_blob.assert_called_once_with(blob, mime_type, None)
     assert video is video_
示例#9
0
 def sha1_fixture(self):
     blob = b"blobish"
     video = Video(blob, None, None)
     expected_value = "de731a6eed12f427642325193b8e57af3c624d62"
     return video, expected_value
示例#10
0
 def it_can_construct_from_a_path(self, from_path_fixture):
     movie_path, mime_type, blob, filename, video_ = from_path_fixture
     video = Video.from_path_or_file_like(movie_path, mime_type)
     Video.from_blob.assert_called_once_with(blob, mime_type, filename)
     assert video is video_
示例#11
0
 def it_can_construct_from_a_blob(self, from_blob_fixture):
     blob, mime_type, filename, Video_init_ = from_blob_fixture
     video = Video.from_blob(blob, mime_type, filename)
     Video_init_.assert_called_once_with(video, blob, mime_type, filename)
     assert isinstance(video, Video)
示例#12
0
 def it_can_construct_from_a_stream(self, from_stream_fixture):
     movie_stream, mime_type, blob, video_ = from_stream_fixture
     video = Video.from_path_or_file_like(movie_stream, mime_type)
     Video.from_blob.assert_called_once_with(blob, mime_type, None)
     assert video is video_
示例#13
0
 def it_can_construct_from_a_path(self, from_path_fixture):
     movie_path, mime_type, blob, filename, video_ = from_path_fixture
     video = Video.from_path_or_file_like(movie_path, mime_type)
     Video.from_blob.assert_called_once_with(blob, mime_type, filename)
     assert video is video_