From 1d7d480efe52589557bdc6371731fad6d15ee1f6 Mon Sep 17 00:00:00 2001 From: crobibero Date: Mon, 22 Jun 2020 08:14:07 -0600 Subject: [PATCH] fix tests --- .../Controllers/BrandingController.cs | 7 +---- MediaBrowser.Api/TestService.cs | 26 +++++++++++++++++++ tests/Jellyfin.Api.Tests/GetPathValueTests.cs | 4 +-- .../BrandingServiceTests.cs | 2 +- 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 MediaBrowser.Api/TestService.cs diff --git a/Jellyfin.Api/Controllers/BrandingController.cs b/Jellyfin.Api/Controllers/BrandingController.cs index d580fedffd..67790c0e4a 100644 --- a/Jellyfin.Api/Controllers/BrandingController.cs +++ b/Jellyfin.Api/Controllers/BrandingController.cs @@ -51,12 +51,7 @@ namespace Jellyfin.Api.Controllers public ActionResult GetBrandingCss() { var options = _serverConfigurationManager.GetConfiguration("branding"); - if (string.IsNullOrEmpty(options.CustomCss)) - { - return NoContent(); - } - - return options.CustomCss; + return options.CustomCss ?? string.Empty; } } } diff --git a/MediaBrowser.Api/TestService.cs b/MediaBrowser.Api/TestService.cs new file mode 100644 index 0000000000..6c999e08d1 --- /dev/null +++ b/MediaBrowser.Api/TestService.cs @@ -0,0 +1,26 @@ +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Net; +using Microsoft.Extensions.Logging; + +namespace MediaBrowser.Api +{ + /// + /// Service for testing path value. + /// + public class TestService : BaseApiService + { + /// + /// Test service. + /// + /// Instance of the interface. + /// Instance of the interface. + /// Instance of the interface. + public TestService( + ILogger logger, + IServerConfigurationManager serverConfigurationManager, + IHttpResultFactory httpResultFactory) + : base(logger, serverConfigurationManager, httpResultFactory) + { + } + } +} diff --git a/tests/Jellyfin.Api.Tests/GetPathValueTests.cs b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs index b01d1af1f0..397eb2edc3 100644 --- a/tests/Jellyfin.Api.Tests/GetPathValueTests.cs +++ b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs @@ -31,8 +31,8 @@ namespace Jellyfin.Api.Tests var confManagerMock = Mock.Of(x => x.Configuration == conf); - var service = new BrandingService( - new NullLogger(), + var service = new TestService( + new NullLogger(), confManagerMock, Mock.Of()) { diff --git a/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs b/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs index 34698fe251..5d7f7765cd 100644 --- a/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs +++ b/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Api.Tests // Assert response.EnsureSuccessStatusCode(); - Assert.Equal("text/css", response.Content.Headers.ContentType.ToString()); + Assert.Equal("text/css; charset=utf-8", response.Content.Headers.ContentType.ToString()); } } }