af1152b001
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
// <copyright file="PluginsControllerTests.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Server.Integration.Tests.Controllers;
|
|
|
|
using System.Net;
|
|
using System.Net.Http.Json;
|
|
using System.Net.Mime;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Extensions.Json;
|
|
using MediaBrowser.Model.Plugins;
|
|
using Xunit;
|
|
|
|
public sealed class PluginsControllerTests : IClassFixture<JellyfinApplicationFactory>
|
|
{
|
|
private readonly JellyfinApplicationFactory _factory;
|
|
private static string? _accessToken;
|
|
|
|
public PluginsControllerTests(JellyfinApplicationFactory factory)
|
|
{
|
|
_factory = factory;
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetPlugins_Unauthorized_ReturnsUnauthorized()
|
|
{
|
|
var client = _factory.CreateClient();
|
|
|
|
var response = await client.GetAsync("/Plugins");
|
|
|
|
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetPlugins_Authorized_ReturnsCorrectResponse()
|
|
{
|
|
var client = _factory.CreateClient();
|
|
client.DefaultRequestHeaders.AddAuthHeader(_accessToken ??= await AuthHelper.CompleteStartupAsync(client));
|
|
|
|
var response = await client.GetAsync("/Plugins");
|
|
|
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
Assert.Equal(MediaTypeNames.Application.Json, response.Content.Headers.ContentType?.MediaType);
|
|
Assert.Equal(Encoding.UTF8.BodyName, response.Content.Headers.ContentType?.CharSet);
|
|
_ = await response.Content.ReadFromJsonAsync<PluginInfo[]>(JsonDefaults.Options);
|
|
}
|
|
}
|