A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dotnet-architecture/eShopOnContainers/issues/1404 below:

IntegrationEventsScenarios and MarketingScenarios Unit Tests fail due to missing call to app.UseAuthorization() · Issue #1404 · dotnet-architecture/eShopOnContainers · GitHub

Running the unit test cases IntegrationEventsScenarios.Post_update_product_price_and_catalog_and_basket_list_modified and MarketingScenarios.Set_new_user_location_and_get_location_campaign_by_user_id on my Windows 10 dev machine, both failed with the same error (after local fix of #1403):

Message: 
    System.InvalidOperationException : Endpoint Microsoft.eShopOnContainers.Services.Basket.API.Controllers.BasketController.UpdateBasketAsync (Basket.API) contains authorization metadata, but a middleware was not found that supports authorization.
    Configure your application startup by adding app.UseAuthorization() inside the call to Configure(..) in the application startup code. The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...).
  Stack Trace: 
    EndpointMiddleware.ThrowMissingAuthMiddlewareException(Endpoint endpoint)
    EndpointMiddleware.Invoke(HttpContext httpContext)
    StaticFileMiddleware.Invoke(HttpContext context)
    AutoAuthorizeMiddleware.Invoke(HttpContext httpContext) line 30
    SwaggerUIMiddleware.Invoke(HttpContext httpContext)
    SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
    <<SendAsync>g__RunRequestAsync|0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    ClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
    IntegrationEventsScenarios.Post_update_product_price_and_catalog_and_basket_list_modified() line 37
    --- End of stack trace from previous location where exception was thrown ---

Looking at the code I noticed that a call to app.UseAuthorization() was not implemented by the three test service startup classes BasketTestsStartup, LocationsTestsStartup, and MarketingTestsStartup in the overloaded method ConfigureAuth in case the configuration item isTest is set to true.

After adding this call, both test cases passed, and none of the other test cases were impacted.

I suggest to add the missing call mentioned above. If you agree, I offer to create the corresponding PR.

Kind Regards,

Stefan


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4