mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 18:48:15 +08:00
changed to json configuration to get rid of yaml imports
This commit is contained in:
@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.Yaml;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -31,16 +31,16 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_401_using_identity_server_access_token()
|
||||
{
|
||||
var yamlConfiguration = new YamlConfiguration
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamTemplate = _downstreamServiceRootUrl,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
@ -55,7 +55,7 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceRootUrl, 201, string.Empty))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
@ -66,16 +66,16 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_401_using_identity_server_reference_token()
|
||||
{
|
||||
var yamlConfiguration = new YamlConfiguration
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamTemplate = _downstreamServiceRootUrl,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
@ -90,7 +90,7 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", AccessTokenType.Reference))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceRootUrl, 201, string.Empty))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
@ -101,16 +101,16 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_response_200_using_identity_server()
|
||||
{
|
||||
var yamlConfiguration = new YamlConfiguration
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamTemplate = _downstreamServiceRootUrl,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
@ -126,7 +126,7 @@ namespace Ocelot.AcceptanceTests
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceRootUrl, 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
@ -138,16 +138,16 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_201_using_identity_server_access_token()
|
||||
{
|
||||
var yamlConfiguration = new YamlConfiguration
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamTemplate = _downstreamServiceRootUrl,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
@ -163,7 +163,7 @@ namespace Ocelot.AcceptanceTests
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceRootUrl, 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
@ -175,16 +175,16 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_201_using_identity_server_reference_token()
|
||||
{
|
||||
var yamlConfiguration = new YamlConfiguration
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamTemplate = _downstreamServiceRootUrl,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
@ -200,7 +200,7 @@ namespace Ocelot.AcceptanceTests
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", AccessTokenType.Reference))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceRootUrl, 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
|
Reference in New Issue
Block a user