diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-03-01 19:35:58 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-03-09 14:17:59 +0100 |
| commit | fa8bfece4e72c32f8350aaa947c81b2494f6bb77 (patch) | |
| tree | 4127ed61aa85dda237bc6eb9fb121aa61736d39e /tests/Jellyfin.Server.Integration.Tests/Controllers/BrandingControllerTests.cs | |
| parent | 94db751f4b4c8d0a1847708d492a90efdaac5048 (diff) | |
Split integration tests from unit tests
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/BrandingControllerTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Integration.Tests/Controllers/BrandingControllerTests.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/BrandingControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/BrandingControllerTests.cs new file mode 100644 index 000000000..fdd93f20e --- /dev/null +++ b/tests/Jellyfin.Server.Integration.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.Server.Integration.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); + } + } +} |
