diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-02-22 13:46:40 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-02-22 13:46:40 +0100 |
| commit | ec3237ba55a6c0c6e7a31e2aaa5fbf77c9978ac7 (patch) | |
| tree | ee4d80921b8f289a1f4dbc05310a48f5a2b7bd5f | |
| parent | 57102090d307a62b3759177df3ba545cfad6c327 (diff) | |
Fix tests
| -rw-r--r-- | Jellyfin.Api/Controllers/DashboardController.cs | 1 | ||||
| -rw-r--r-- | Jellyfin.Api/Models/ConfigurationPageInfo.cs | 8 | ||||
| -rw-r--r-- | tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs | 9 |
3 files changed, 14 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/DashboardController.cs b/Jellyfin.Api/Controllers/DashboardController.cs index 0c19f2818..a2c2ecd66 100644 --- a/Jellyfin.Api/Controllers/DashboardController.cs +++ b/Jellyfin.Api/Controllers/DashboardController.cs @@ -6,7 +6,6 @@ using System.Net.Mime; using Jellyfin.Api.Attributes; using Jellyfin.Api.Models; using MediaBrowser.Common.Plugins; -using MediaBrowser.Controller; using MediaBrowser.Model.Net; using MediaBrowser.Model.Plugins; using Microsoft.AspNetCore.Http; diff --git a/Jellyfin.Api/Models/ConfigurationPageInfo.cs b/Jellyfin.Api/Models/ConfigurationPageInfo.cs index d21428029..ec4a0d1a1 100644 --- a/Jellyfin.Api/Models/ConfigurationPageInfo.cs +++ b/Jellyfin.Api/Models/ConfigurationPageInfo.cs @@ -25,6 +25,14 @@ namespace Jellyfin.Api.Models } /// <summary> + /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. + /// </summary> + public ConfigurationPageInfo() + { + Name = string.Empty; + } + + /// <summary> /// Gets or sets the name. /// </summary> /// <value>The name.</value> diff --git a/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs index fadeddba5..84d362a39 100644 --- a/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs +++ b/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs @@ -3,6 +3,7 @@ using System.Net; using System.Text.Json; using System.Threading.Tasks; using Jellyfin.Api.Models; +using MediaBrowser.Common.Json; using Xunit; namespace Jellyfin.Api.Tests.Controllers @@ -10,6 +11,7 @@ namespace Jellyfin.Api.Tests.Controllers public sealed class DashboardControllerTests : IClassFixture<JellyfinApplicationFactory> { private readonly JellyfinApplicationFactory _factory; + private readonly JsonSerializerOptions _jsonOpions = JsonDefaults.GetOptions(); public DashboardControllerTests(JellyfinApplicationFactory factory) { @@ -57,7 +59,6 @@ namespace Jellyfin.Api.Tests.Controllers var response = await client.GetAsync("/web/ConfigurationPages").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); - var res = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(await response.Content.ReadAsStreamAsync()); // TODO: check content } @@ -69,8 +70,10 @@ namespace Jellyfin.Api.Tests.Controllers var response = await client.GetAsync("/web/ConfigurationPages?enableInMainMenu=true").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); - var res = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(await response.Content.ReadAsStreamAsync()); - Assert.Empty(res); + var res = await response.Content.ReadAsStreamAsync(); + System.Console.WriteLine(res); + var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions); + Assert.Empty(data); } } } |
