Fix tests

This commit is contained in:
Bond_009 2021-02-22 13:46:40 +01:00
parent 57102090d3
commit ec3237ba55
3 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,6 @@ using System.Net.Mime;
using Jellyfin.Api.Attributes; using Jellyfin.Api.Attributes;
using Jellyfin.Api.Models; using Jellyfin.Api.Models;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Controller;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;

View File

@ -24,6 +24,14 @@ namespace Jellyfin.Api.Models
PluginId = plugin?.Id; PluginId = plugin?.Id;
} }
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class.
/// </summary>
public ConfigurationPageInfo()
{
Name = string.Empty;
}
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>

View File

@ -3,6 +3,7 @@ using System.Net;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Jellyfin.Api.Models; using Jellyfin.Api.Models;
using MediaBrowser.Common.Json;
using Xunit; using Xunit;
namespace Jellyfin.Api.Tests.Controllers namespace Jellyfin.Api.Tests.Controllers
@ -10,6 +11,7 @@ namespace Jellyfin.Api.Tests.Controllers
public sealed class DashboardControllerTests : IClassFixture<JellyfinApplicationFactory> public sealed class DashboardControllerTests : IClassFixture<JellyfinApplicationFactory>
{ {
private readonly JellyfinApplicationFactory _factory; private readonly JellyfinApplicationFactory _factory;
private readonly JsonSerializerOptions _jsonOpions = JsonDefaults.GetOptions();
public DashboardControllerTests(JellyfinApplicationFactory factory) public DashboardControllerTests(JellyfinApplicationFactory factory)
{ {
@ -57,7 +59,6 @@ namespace Jellyfin.Api.Tests.Controllers
var response = await client.GetAsync("/web/ConfigurationPages").ConfigureAwait(false); var response = await client.GetAsync("/web/ConfigurationPages").ConfigureAwait(false);
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);
var res = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(await response.Content.ReadAsStreamAsync());
// TODO: check content // TODO: check content
} }
@ -69,8 +70,10 @@ namespace Jellyfin.Api.Tests.Controllers
var response = await client.GetAsync("/web/ConfigurationPages?enableInMainMenu=true").ConfigureAwait(false); var response = await client.GetAsync("/web/ConfigurationPages?enableInMainMenu=true").ConfigureAwait(false);
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);
var res = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(await response.Content.ReadAsStreamAsync()); var res = await response.Content.ReadAsStreamAsync();
Assert.Empty(res); System.Console.WriteLine(res);
var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions);
Assert.Empty(data);
} }
} }
} }