diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2021-02-23 19:19:38 +0900 |
|---|---|---|
| committer | dkanada <dkanada@users.noreply.github.com> | 2021-02-23 19:19:38 +0900 |
| commit | bc746b4d05f440b4910751ab7ae70e81ad470892 (patch) | |
| tree | 0642ed74e91511214e4d4b8a3beb40b9c7a8e7d4 /tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs | |
| parent | 9caf3119257544d6fb8fd3e1f1cb2b50eba7bd39 (diff) | |
| parent | 7ece3c552337340a997a75aab1520a501a673f61 (diff) | |
merge branch 'master' into auto-manifest
Diffstat (limited to 'tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs')
| -rw-r--r-- | tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs new file mode 100644 index 000000000..40933562d --- /dev/null +++ b/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs @@ -0,0 +1,53 @@ +using System.Net.Mime; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +using MediaBrowser.Model.Branding; +using Xunit; + +namespace Jellyfin.Api.Tests +{ + public sealed class BrandingControllerTests : IClassFixture<JellyfinApplicationFactory> + { + private readonly JellyfinApplicationFactory _factory; + + public BrandingControllerTests(JellyfinApplicationFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task GetConfiguration_ReturnsCorrectResponse() + { + // Arrange + var client = _factory.CreateClient(); + + // Act + var response = await client.GetAsync("/Branding/Configuration"); + + // Assert + Assert.True(response.IsSuccessStatusCode); + Assert.Equal(MediaTypeNames.Application.Json, response.Content.Headers.ContentType?.MediaType); + Assert.Equal(Encoding.UTF8.BodyName, response.Content.Headers.ContentType?.CharSet); + var responseBody = await response.Content.ReadAsStreamAsync(); + _ = await JsonSerializer.DeserializeAsync<BrandingOptions>(responseBody); + } + + [Theory] + [InlineData("/Branding/Css")] + [InlineData("/Branding/Css.css")] + public async Task GetCss_ReturnsCorrectResponse(string url) + { + // Arrange + var client = _factory.CreateClient(); + + // Act + var response = await client.GetAsync(url); + + // Assert + Assert.True(response.IsSuccessStatusCode); + Assert.Equal("text/css", response.Content.Headers.ContentType?.MediaType); + Assert.Equal(Encoding.UTF8.BodyName, response.Content.Headers.ContentType?.CharSet); + } + } +} |
