aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs')
-rw-r--r--tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/DashboardControllerTests.cs
index 84d362a39..300b2697f 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.Controllers
var 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.Controllers
var 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.Controllers
var 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);
}