Browse Source

Update functional tests

pull/299/head
Unai Zorrilla Castro 7 years ago
parent
commit
6ac34cbdaa
7 changed files with 33 additions and 13 deletions
  1. +8
    -1
      src/Services/Basket/Basket.API/Startup.cs
  2. +6
    -1
      src/Services/Location/Locations.API/Startup.cs
  3. +6
    -1
      src/Services/Marketing/Marketing.API/Startup.cs
  4. +3
    -4
      test/Services/FunctionalTests/FunctionalTests.csproj
  5. +2
    -1
      test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs
  6. +4
    -1
      test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs
  7. +4
    -4
      test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs

+ 8
- 1
src/Services/Basket/Basket.API/Startup.cs View File

@ -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();
}
}
}

+ 6
- 1
src/Services/Location/Locations.API/Startup.cs View File

@ -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();
}
}
}

+ 6
- 1
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -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
- 4
test/Services/FunctionalTests/FunctionalTests.csproj View File

@ -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
- 1
test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs View File

@ -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
- 1
test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs View File

@ -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);
}
}


+ 4
- 4
test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs View File

@ -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…
Cancel
Save