The Free Software Media System - Server Backend & API
Address comments
Bond_009baadc48f43ec
diff --git a/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.csindex 3207a0f257..40933562db 100644--- a/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs+++ b/tests/Jellyfin.Api.Tests/Controllers/BrandingControllerTests.cs@@ -1,3 +1,5 @@+using System.Net.Mime;+using System.Text;using System.Text.Json;using System.Threading.Tasks;using MediaBrowser.Model.Branding;@@ -25,8 +27,8 @@ namespace Jellyfin.Api.Tests// AssertAssert.True(response.IsSuccessStatusCode);- Assert.Equal("application/json", response.Content.Headers.ContentType?.MediaType);- Assert.Equal("utf-8", response.Content.Headers.ContentType?.CharSet);+ 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);}@@ -44,7 +46,8 @@ namespace Jellyfin.Api.Tests// AssertAssert.True(response.IsSuccessStatusCode);- Assert.Equal("text/css; charset=utf-8", response.Content.Headers.ContentType?.ToString());+ Assert.Equal("text/css", response.Content.Headers.ContentType?.MediaType);+ Assert.Equal(Encoding.UTF8.BodyName, response.Content.Headers.ContentType?.CharSet);}}}diff --git a/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.csindex 84d362a397..300b2697f2 100644--- a/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs+++ b/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs@@ -1,5 +1,7 @@using System.IO;using System.Net;+using System.Net.Mime;+using System.Text;using System.Text.Json;using System.Threading.Tasks;using Jellyfin.Api.Models;@@ -23,7 +25,7 @@ namespace Jellyfin.Api.Tests.Controllers{var client = _factory.CreateClient();- var response = await client.GetAsync("web/ConfigurationPage/ThisPageTotally/Doesnt/Exists.html").ConfigureAwait(false);+ var response = await client.GetAsync("web/ConfigurationPage?name=ThisPageDoesntExists").ConfigureAwait(false);Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);}@@ -36,7 +38,7 @@ namespace Jellyfin.Api.Tests.Controllersvar response = await client.GetAsync("/web/ConfigurationPage?name=TestPlugin").ConfigureAwait(false);Assert.True(response.IsSuccessStatusCode);- Assert.Equal("text/html", response.Content.Headers.ContentType?.MediaType);+ Assert.Equal(MediaTypeNames.Text.Html, response.Content.Headers.ContentType?.MediaType);StreamReader reader = new StreamReader(typeof(TestPlugin).Assembly.GetManifestResourceStream("Jellyfin.Api.Tests.TestPage.html")!);Assert.Equal(await response.Content.ReadAsStringAsync(), reader.ReadToEnd());}@@ -59,6 +61,9 @@ namespace Jellyfin.Api.Tests.Controllersvar response = await client.GetAsync("/web/ConfigurationPages").ConfigureAwait(false);Assert.True(response.IsSuccessStatusCode);++ var res = await response.Content.ReadAsStreamAsync();+ _ = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions);// TODO: check content}@@ -70,8 +75,10 @@ namespace Jellyfin.Api.Tests.Controllersvar response = await client.GetAsync("/web/ConfigurationPages?enableInMainMenu=true").ConfigureAwait(false);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 res = await response.Content.ReadAsStreamAsync();- System.Console.WriteLine(res);var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions);Assert.Empty(data);}