mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
33 lines
994 B
C#
33 lines
994 B
C#
|
using System.Net;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|||
|
using Xunit;
|
|||
|
|
|||
|
namespace Jellyfin.Server.Integration.Tests.Middleware
|
|||
|
{
|
|||
|
public sealed class RobotsRedirectionMiddlewareTests : IClassFixture<JellyfinApplicationFactory>
|
|||
|
{
|
|||
|
private readonly JellyfinApplicationFactory _factory;
|
|||
|
|
|||
|
public RobotsRedirectionMiddlewareTests(JellyfinApplicationFactory factory)
|
|||
|
{
|
|||
|
_factory = factory;
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public async Task RobotsDotTxtRedirects()
|
|||
|
{
|
|||
|
var client = _factory.CreateClient(
|
|||
|
new WebApplicationFactoryClientOptions()
|
|||
|
{
|
|||
|
AllowAutoRedirect = false
|
|||
|
});
|
|||
|
|
|||
|
var response = await client.GetAsync("robots.txt").ConfigureAwait(false);
|
|||
|
|
|||
|
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
|||
|
Assert.Equal("web/robots.txt", response.Headers.Location?.ToString());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|