jellyfin/tests/Jellyfin.MediaEncoding.Hls.Tests/Playlist/DynamicHlsPlaylistGeneratorTests.cs

26 lines
1.0 KiB
C#
Raw Normal View History

2021-09-25 02:17:16 -07:00
using Jellyfin.MediaEncoding.Hls.Playlist;
using Xunit;
namespace Jellyfin.MediaEncoding.Hls.Tests.Playlist
{
public class DynamicHlsPlaylistGeneratorTests
{
[Theory]
[InlineData("testfile.mkv", new string[0], false)]
[InlineData("testfile.flv", new[] { "mp4", "mkv", "ts" }, false)]
[InlineData("testfile.flv", new[] { "mp4", "mkv", "ts", "flv" }, true)]
[InlineData("/some/arbitrarily/long/path/testfile.mkv", new[] { "mkv" }, true)]
public void IsExtractionAllowedForFile_Valid_Success(string filePath, string[] allowedExtensions, bool isAllowed)
{
Assert.Equal(isAllowed, DynamicHlsPlaylistGenerator.IsExtractionAllowedForFile(filePath, allowedExtensions));
}
[Theory]
[InlineData("testfile", new[] { "mp4" })]
public void IsExtractionAllowedForFile_Invalid_ReturnsFalse(string filePath, string[] allowedExtensions)
{
Assert.False(DynamicHlsPlaylistGenerator.IsExtractionAllowedForFile(filePath, allowedExtensions));
}
}
}