mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	Merge pull request #2245 from BnMcG/1874-regression-test
Add a test to prevent a regression of absolute path generation behaviour
This commit is contained in:
		
						commit
						c3efcbf77e
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
 | 
					Microsoft Visual Studio Solution File, Format Version 12.00
 | 
				
			||||||
# Visual Studio 15
 | 
					# Visual Studio 15
 | 
				
			||||||
VisualStudioVersion = 15.0.26730.3
 | 
					VisualStudioVersion = 15.0.26730.3
 | 
				
			||||||
MinimumVisualStudioVersion = 10.0.40219.1
 | 
					MinimumVisualStudioVersion = 10.0.40219.1
 | 
				
			||||||
@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Naming.Tests", "te
 | 
				
			|||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Api.Tests", "tests\Jellyfin.Api.Tests\Jellyfin.Api.Tests.csproj", "{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}"
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Api.Tests", "tests\Jellyfin.Api.Tests\Jellyfin.Api.Tests.csproj", "{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}"
 | 
				
			||||||
EndProject
 | 
					EndProject
 | 
				
			||||||
 | 
					Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Server.Implementations.Tests", "tests\Jellyfin.Server.Implementations.Tests\Jellyfin.Server.Implementations.Tests.csproj", "{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}"
 | 
				
			||||||
 | 
					EndProject
 | 
				
			||||||
Global
 | 
					Global
 | 
				
			||||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
						GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
				
			||||||
		Debug|Any CPU = Debug|Any CPU
 | 
							Debug|Any CPU = Debug|Any CPU
 | 
				
			||||||
@ -164,6 +166,10 @@ Global
 | 
				
			|||||||
		{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
							{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
		{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
							{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
		{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
							{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
 | 
							{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
				
			||||||
 | 
							{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
				
			||||||
 | 
							{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
				
			||||||
 | 
							{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
				
			||||||
	EndGlobalSection
 | 
						EndGlobalSection
 | 
				
			||||||
	GlobalSection(SolutionProperties) = preSolution
 | 
						GlobalSection(SolutionProperties) = preSolution
 | 
				
			||||||
		HideSolutionNode = FALSE
 | 
							HideSolutionNode = FALSE
 | 
				
			||||||
@ -194,5 +200,6 @@ Global
 | 
				
			|||||||
		{28464062-0939-4AA7-9F7B-24DDDA61A7C0} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
							{28464062-0939-4AA7-9F7B-24DDDA61A7C0} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
				
			||||||
		{3998657B-1CCC-49DD-A19F-275DC8495F57} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
							{3998657B-1CCC-49DD-A19F-275DC8495F57} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
				
			||||||
		{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
							{A2FD0A10-8F62-4F9D-B171-FFDF9F0AFA9D} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
				
			||||||
 | 
							{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
 | 
				
			||||||
	EndGlobalSection
 | 
						EndGlobalSection
 | 
				
			||||||
EndGlobal
 | 
					EndGlobal
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					using AutoFixture;
 | 
				
			||||||
 | 
					using AutoFixture.AutoMoq;
 | 
				
			||||||
 | 
					using Emby.Server.Implementations.IO;
 | 
				
			||||||
 | 
					using Xunit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Jellyfin.Server.Implementations.Tests.IO
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class ManagedFileSystemTests
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        private readonly IFixture _fixture;
 | 
				
			||||||
 | 
					        private readonly ManagedFileSystem _sut;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public ManagedFileSystemTests()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            _fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true });
 | 
				
			||||||
 | 
					            _sut = _fixture.Create<ManagedFileSystem>();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Theory]
 | 
				
			||||||
 | 
					        [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")]
 | 
				
			||||||
 | 
					        [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")]
 | 
				
			||||||
 | 
					        [InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")]
 | 
				
			||||||
 | 
					        public void MakeAbsolutePathCorrectlyHandlesRelativeFilePaths(
 | 
				
			||||||
 | 
					            string folderPath,
 | 
				
			||||||
 | 
					            string filePath,
 | 
				
			||||||
 | 
					            string expectedAbsolutePath)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
 | 
				
			||||||
 | 
					            Assert.Equal(expectedAbsolutePath, generatedPath);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					<Project Sdk="Microsoft.NET.Sdk">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <PropertyGroup>
 | 
				
			||||||
 | 
					        <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <IsPackable>false</IsPackable>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <RootNamespace>Jellyfin.Server.Implementations.Tests</RootNamespace>
 | 
				
			||||||
 | 
					    </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ItemGroup>
 | 
				
			||||||
 | 
					        <PackageReference Include="AutoFixture" Version="4.11.0" />
 | 
				
			||||||
 | 
					        <PackageReference Include="AutoFixture.AutoMoq" Version="4.11.0" />
 | 
				
			||||||
 | 
					        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
 | 
				
			||||||
 | 
					        <PackageReference Include="Moq" Version="4.13.1" />
 | 
				
			||||||
 | 
					        <PackageReference Include="xunit" Version="2.4.0" />
 | 
				
			||||||
 | 
					        <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
 | 
				
			||||||
 | 
					        <PackageReference Include="coverlet.collector" Version="1.0.1" />
 | 
				
			||||||
 | 
					    </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ItemGroup>
 | 
				
			||||||
 | 
					      <ProjectReference Include="..\..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
 | 
				
			||||||
 | 
					    </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Project>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user