Update functional tests
This commit is contained in:
parent
cd78d98436
commit
6ac34cbdaa
@ -167,7 +167,9 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
{
|
||||
app.UseStaticFiles();
|
||||
app.UseCors("CorsPolicy");
|
||||
app.UseAuthentication();
|
||||
|
||||
ConfigureAuth(app);
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
||||
app.UseSwagger()
|
||||
@ -216,5 +218,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>();
|
||||
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>();
|
||||
}
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
||||
{
|
||||
app.UseCors("CorsPolicy");
|
||||
|
||||
app.UseAuthentication();
|
||||
ConfigureAuth(app);
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
||||
@ -176,5 +176,10 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
||||
|
||||
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||
}
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@
|
||||
{
|
||||
app.UseCors("CorsPolicy");
|
||||
|
||||
app.UseAuthentication();
|
||||
ConfigureAuth(app);
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
||||
@ -243,5 +243,10 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
protected virtual void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<!--<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>-->
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
@ -45,9 +45,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.2.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
@ -2,12 +2,13 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace FunctionalTests.Services.Basket
|
||||
{
|
||||
public class BasketTestsStartup : Startup
|
||||
{
|
||||
public BasketTestsStartup(IHostingEnvironment env) : base(env)
|
||||
public BasketTestsStartup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,13 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.eShopOnContainers.Services.Locations.API;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class LocationsTestsStartup : Startup
|
||||
{
|
||||
public LocationsTestsStartup(IHostingEnvironment env) : base(env)
|
||||
public LocationsTestsStartup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
}
|
||||
|
||||
@ -28,6 +29,7 @@
|
||||
class LocationAuthorizeMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public LocationAuthorizeMiddleware(RequestDelegate rd)
|
||||
{
|
||||
_next = rd;
|
||||
@ -38,6 +40,7 @@
|
||||
var identity = new ClaimsIdentity("cookies");
|
||||
identity.AddClaim(new Claim("sub", "4611ce3f-380d-4db5-8d76-87a8689058ed"));
|
||||
httpContext.User.AddIdentity(identity);
|
||||
|
||||
await _next.Invoke(httpContext);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace FunctionalTests.Services.Marketing
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using FunctionalTests.Middleware;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
public class MarketingTestsStartup : Startup
|
||||
{
|
||||
public MarketingTestsStartup(IHostingEnvironment env) : base(env)
|
||||
public MarketingTestsStartup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user