mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-08-04 19:42:25 +08:00
Rename all ReRoute to Route to move closer to YARP +semver: breaking
This commit is contained in:
@ -15,11 +15,11 @@ using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Security
|
||||
{
|
||||
using Ocelot.DownstreamRouteFinder.Middleware;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Shouldly;
|
||||
|
||||
{
|
||||
using Ocelot.DownstreamRouteFinder.Middleware;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Shouldly;
|
||||
|
||||
public class SecurityMiddlewareTests
|
||||
{
|
||||
private List<Mock<ISecurityPolicy>> _securityPolicyList;
|
||||
@ -42,7 +42,7 @@ namespace Ocelot.UnitTests.Security
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
_middleware = new SecurityMiddleware(_next, _loggerFactory.Object, _securityPolicyList.Select(f => f.Object).ToList());
|
||||
_middleware = new SecurityMiddleware(_next, _loggerFactory.Object, _securityPolicyList.Select(f => f.Object).ToList());
|
||||
_httpContext.Items.UpsertDownstreamRequest(new DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "http://test.com")));
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ namespace Ocelot.UnitTests.Security
|
||||
foreach (var item in _securityPolicyList)
|
||||
{
|
||||
Response response = new OkResponse();
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamReRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,12 +82,12 @@ namespace Ocelot.UnitTests.Security
|
||||
{
|
||||
Error error = new UnauthenticatedError($"Not passing security verification");
|
||||
Response response = new ErrorResponse(error);
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamReRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response response = new OkResponse();
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamReRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
item.Setup(x => x.Security(_httpContext.Items.DownstreamRoute(), _httpContext)).Returns(Task.FromResult(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,12 +98,12 @@ namespace Ocelot.UnitTests.Security
|
||||
}
|
||||
|
||||
private void ThenTheRequestIsPassingSecurity()
|
||||
{
|
||||
{
|
||||
_httpContext.Items.Errors().Count.ShouldBe(0);
|
||||
}
|
||||
|
||||
private void ThenTheRequestIsNotPassingSecurity()
|
||||
{
|
||||
{
|
||||
_httpContext.Items.Errors().Count.ShouldBeGreaterThan(0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user