Writing integration tests for .net core endpoints with authentication
I have built and endpoint using asp.net api controllers with the authorize attribute.
I am using the TestAuthHandler with a custom web app factory approach to test these endpoints but I still get unauthorized.
I realized HandleAuthenticateAsync method I have overriden in the TestAuthHandler is not being invoked.
This is a link to resource I was following https://gunnarpeipman.com/aspnet-core-integration-test-fake-user/
Kindly help me out.
Gunnar Peipman - Programming Blog
Create fake user for ASP.NET Core integration tests
Creating fake users for ASP.NET Core integration tests by writing extension methods for web application factory and client.
1 Reply
I have figured it out thanks