What is the appropriate way to test this route registration code for OAuth2 tokens?

I am currently working with a shell for OAuth2 authentication code, which requires the following function to be called when the application starts:

public static void RegisterServer(IAppBuilder app, OAuthServerProvider provider)
{
    // Generate the tokens for the application
    app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions
    {
        // Require the use of HTTPS, this will cause a 404 error over HTTP
        AllowInsecureHttp = true,
        TokenEndpointPath = new PathString("/token"),
        AccessTokenExpireTimeSpan = TimeSpan.FromHours(8),
        Provider = provider
    });
    // Enable the token consumption
    app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}

What would be the appropriate method for the unit test of this function to ensure that the marker endpoint is correctly registered? Alternatively, is this something that should be limited to functional testing on a larger scale?

+4
source share

Source: https://habr.com/ru/post/1534473/


All Articles