def test_refresh_failure(mock_validator, mock_stat, mock_media_info): mock_stat.return_value = stat_return() metadata = metadata_return() for track in metadata.tracks: track.track_type = "not-video" mock_media_info.parse.return_value = metadata mock_validator().quality_similar_to.return_value = "1080p" v = Video("foo.mkv", "/not-a-real-path/bar") with pytest.raises(RuntimeError): v.refresh()
def test_refresh(mock_needs_refresh, mock_get_size, mock_validator, mock_media_info): expected_codec = Codec("HEVC") mock_media_info.parse.return_value = metadata_return() mock_validator().quality_similar_to.return_value = "1080p" v = Video("foo.mkv", "/not-a-real-path/bar") v.refresh() assert v.codec == expected_codec assert v.quality == "1080p" assert v.size == 12345
def test_refresh_not_required(mock_needs_refresh, mock_validator, mock_parse): v = Video("foo.mkv", "/not-a-real-path/bar") v.refresh() assert mock_parse.called is False