aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-04-20 15:47:36 -0400
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-04-20 15:47:36 -0400
commite43e6af405dcc8cd5cff71ca39e671de7dba5ce6 (patch)
tree341047c728357da43aa88c6298e0f71a8b5678f2
parent307754a0e0a88ac331c1e8bb98e46ce51d004fd6 (diff)
Create integration tests for the endpoints in BrandingService
-rw-r--r--tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs b/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs
new file mode 100644
index 000000000..881617914
--- /dev/null
+++ b/tests/MediaBrowser.Api.Tests/BrandingServiceTests.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Text.Json;
+using System.Threading.Tasks;
+using Jellyfin.Server;
+using MediaBrowser.Model.Branding;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Xunit;
+
+namespace MediaBrowser.Api.Tests
+{
+ public sealed class BrandingServiceTests : IClassFixture<JellyfinApplicationFactory>
+ {
+ private readonly JellyfinApplicationFactory _factory;
+
+ public BrandingServiceTests(JellyfinApplicationFactory factory)
+ {
+ _factory = factory;
+ }
+
+ [Fact]
+ public async Task GetConfiguration_ReturnsCorrectResponse()
+ {
+ // Arrange
+ var client = _factory.CreateClient();
+
+ // Act
+ var response = await client.GetAsync("/Branding/Configuration");
+
+ // Assert
+ response.EnsureSuccessStatusCode();
+ Assert.Equal("application/json; charset=utf-8", response.Content.Headers.ContentType.ToString());
+ 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
+ response.EnsureSuccessStatusCode();
+ Assert.Equal("text/css", response.Content.Headers.ContentType.ToString());
+ }
+ }
+}