mirror of
https://github.com/jellyfin/jellyfin
synced 2024-10-14 19:54:01 +00:00
reverted
This commit is contained in:
parent
688e7c6a2d
commit
b9f0f4f53b
|
@ -43,6 +43,8 @@ using Microsoft.OpenApi.Models;
|
|||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using AuthenticationSchemes = Jellyfin.Api.Constants.AuthenticationSchemes;
|
||||
|
||||
[assembly: InternalsVisibleTo("Jellyfin.Api.Tests")]
|
||||
|
||||
namespace Jellyfin.Server.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -36,12 +36,6 @@
|
|||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
|
||||
<_Parameter1>Jellyfin.Api.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
|
||||
|
@ -79,4 +73,10 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Jellyfin.Api.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -14,27 +14,6 @@ namespace Jellyfin.Api.Tests
|
|||
{
|
||||
public class ParseNetworkTests
|
||||
{
|
||||
private static IConfigurationManager GetMockConfig(NetworkConfiguration conf)
|
||||
{
|
||||
var configManager = new Mock<IConfigurationManager>
|
||||
{
|
||||
CallBase = true
|
||||
};
|
||||
configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf);
|
||||
return (IConfigurationManager)configManager.Object;
|
||||
}
|
||||
|
||||
private static NetworkManager CreateNetworkManager()
|
||||
{
|
||||
var conf = new NetworkConfiguration()
|
||||
{
|
||||
EnableIPV6 = true,
|
||||
EnableIPV4 = true,
|
||||
};
|
||||
|
||||
return new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order of the result has always got to be hosts, then networks.
|
||||
/// </summary>
|
||||
|
@ -53,9 +32,11 @@ namespace Jellyfin.Api.Tests
|
|||
using var nm = CreateNetworkManager();
|
||||
nm.SystemIP6Enabled = ip6;
|
||||
|
||||
var settings = new NetworkConfiguration();
|
||||
settings.EnableIPV4 = ip4;
|
||||
settings.EnableIPV6 = ip6;
|
||||
var settings = new NetworkConfiguration
|
||||
{
|
||||
EnableIPV4 = ip4,
|
||||
EnableIPV6 = ip6
|
||||
};
|
||||
|
||||
var result = match + ',';
|
||||
ForwardedHeadersOptions options = new ForwardedHeadersOptions();
|
||||
|
@ -83,5 +64,26 @@ namespace Jellyfin.Api.Tests
|
|||
|
||||
Assert.True(string.Equals(sb.ToString(), result, StringComparison.OrdinalIgnoreCase), "Not matched: " + sb.ToString() + " does not match " + result);
|
||||
}
|
||||
|
||||
private static IConfigurationManager GetMockConfig(NetworkConfiguration conf)
|
||||
{
|
||||
var configManager = new Mock<IConfigurationManager>
|
||||
{
|
||||
CallBase = true
|
||||
};
|
||||
configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf);
|
||||
return (IConfigurationManager)configManager.Object;
|
||||
}
|
||||
|
||||
private static NetworkManager CreateNetworkManager()
|
||||
{
|
||||
var conf = new NetworkConfiguration()
|
||||
{
|
||||
EnableIPV6 = true,
|
||||
EnableIPV4 = true,
|
||||
};
|
||||
|
||||
return new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue