openiddict-core icon indicating copy to clipboard operation
openiddict-core copied to clipboard

Port the functional validation tests from aspnet-contrib and OpenIddict 2.x

Open kevinchalet opened this issue 6 years ago • 4 comments

Both the aspnet-contrib validation/introspection handlers and OpenIddict have a ton of functional tests that rely on ASP.NET Core's TestServer. As part of the 3.0 effort, we'll need to progressively bring them back:

  • aspnet-contrib tests: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Extensions/tree/dev/test/AspNet.Security.OAuth.Introspection.Tests and https://github.com/aspnet-contrib/AspNet.Security.OAuth.Extensions/tree/dev/test/AspNet.Security.OAuth.Validation.Tests

  • OpenIddict tests: https://github.com/openiddict/openiddict-core/tree/2.0.0/test/OpenIddict.Validation.Tests/Internal

kevinchalet avatar Sep 27 '19 16:09 kevinchalet

@kevinchalet I wanted to give contributing a shot and was going to at least attempt this issue. I have never contributed to a mainstream dotnet project like this so apologies for my green-ness, but I'm have a bit of trouble getting started. I have cloned locally and got everything building. I attempted to create a new test project and was attempting to follow the patterns of the existing test projects. None of the test projects have direct package references to xunit packages. From what I can gather, it looks like that it maybe handled by arcarde. However, I can seem to tell how I get my project to get the xunit packages added in the same way. Do you have any documentation or general instructions on getting things setup? If my limited experience precludes me from being able to contribute effectively, I completely understand. Thanks! I really appreciate this project and your efforts.

anorborg avatar Apr 17 '20 13:04 anorborg

I wanted to give contributing a shot and was going to at least attempt this issue.

@anorborg thanks a lot for your interest!

If my limited experience precludes me from being able to contribute effectively, I completely understand. Thanks!

It's definitely not a problem, and contributing is always a good way to learn new things, so please don't hesitate 😄

None of the test projects have direct package references to xunit packages. From what I can gather, it looks like that it maybe handled by arcarde. However, I can seem to tell how I get my project to get the xunit packages added in the same way. Do you have any documentation or general instructions on getting things setup?

As you figured out, the xUnit package references are indeed automagically added by Arcade, for which the documentation is a bit limited. That said, it mostly works using conventions: your test project must be in the test folder and end with Tests or IntegrationTests.

You can follow the same pattern I adopted for the server integration tests: a "common/shared" project named OpenIddict.Validation.IntegrationTests and two OpenIddict.Validation.AspNetCore.IntegrationTests/OpenIddict.Validation.Owin.IntegrationTests projects for the host-specific tests and the CreateClient method used by the tests in the common projects.

If you're still having issues, please let me know!

kevinchalet avatar Apr 17 '20 14:04 kevinchalet

FYI, the introspection feature hasn't yet been ported to OpenIddict, so please ignore the tests in AspNet.Security.OAuth.Introspection.Tests for now.

kevinchalet avatar Apr 17 '20 14:04 kevinchalet

Note: the introspection feature was ported as part of https://github.com/openiddict/openiddict-core/pull/947.

kevinchalet avatar May 30 '20 17:05 kevinchalet