aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs2
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj12
-rw-r--r--tests/Jellyfin.Api.Tests/ParseNetworkTests.cs50
3 files changed, 34 insertions, 30 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index 73a2265de..bd72b1e27 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -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>
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index cfec2d82f..f91f2db02 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -37,12 +37,6 @@
</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" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" 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>
diff --git a/tests/Jellyfin.Api.Tests/ParseNetworkTests.cs b/tests/Jellyfin.Api.Tests/ParseNetworkTests.cs
index ca7b8a965..6ee66d2a8 100644
--- a/tests/Jellyfin.Api.Tests/ParseNetworkTests.cs
+++ b/tests/Jellyfin.Api.Tests/ParseNetworkTests.cs
@@ -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>());
+ }
}
}