using System.Net;
using Microsoft.AspNetCore.Mvc.Testing;

namespace Tiku.IntegrationTests.Api;

public sealed class PlatformAdminFrontendSeparationTests
{
    [Theory]
    [InlineData("/platform-admin")]
    [InlineData("/platform-admin/")]
    [InlineData("/platform-admin/app.js")]
    public async Task Unauthenticated_platform_admin_paths_use_the_api_fallback_policy(string path)
    {
        await using var factory = new ApiTestFactory();
        using var client = factory.CreateClient(new WebApplicationFactoryClientOptions
        {
            AllowAutoRedirect = false
        });

        using var response = await client.GetAsync(path);

        Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
    }
}