Address comments
This commit is contained in:
parent
ec3237ba55
commit
baadc48f43
|
@ -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
|
|||
|
||||
// Assert
|
||||
Assert.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
|
|||
|
||||
// Assert
|
||||
Assert.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user