44 * for more information concerning the license and the contributors participating to this project.
55 */
66
7- using AspNet . Security . OAuth . Etsy ;
87using static AspNet . Security . OAuth . Etsy . EtsyAuthenticationConstants ;
98
10- namespace AspNet . Security . OAuth . Providers . Tests . Etsy ;
9+ namespace AspNet . Security . OAuth . Etsy ;
1110
12- public class EtsyTests : OAuthTests < EtsyAuthenticationOptions >
11+ public class EtsyTests ( ITestOutputHelper outputHelper ) : OAuthTests < EtsyAuthenticationOptions > ( outputHelper )
1312{
14- public EtsyTests ( ITestOutputHelper outputHelper )
15- : base ( outputHelper )
16- {
17- }
18-
1913 public override string DefaultScheme => EtsyAuthenticationDefaults . AuthenticationScheme ;
2014
2115 protected internal override void RegisterAuthentication ( AuthenticationBuilder builder )
@@ -33,7 +27,7 @@ public async Task Can_Sign_In_Using_Etsy(string claimType, string claimValue)
3327 public async Task Does_Not_Include_Detailed_Claims_When_IncludeDetailedUserInfo_Is_False ( )
3428 {
3529 // Arrange: disable detailed user info enrichment
36- void ConfigureServices ( IServiceCollection services ) => services . PostConfigureAll < EtsyAuthenticationOptions > ( o => o . IncludeDetailedUserInfo = false ) ;
30+ static void ConfigureServices ( IServiceCollection services ) => services . PostConfigureAll < EtsyAuthenticationOptions > ( o => o . IncludeDetailedUserInfo = false ) ;
3731
3832 using var server = CreateTestServer ( ConfigureServices ) ;
3933
@@ -55,24 +49,7 @@ public async Task Does_Not_Include_Detailed_Claims_When_IncludeDetailedUserInfo_
5549 public async Task Includes_Detailed_Claims_When_IncludeDetailedUserInfo_Is_True ( )
5650 {
5751 // Arrange: enable detailed user info, configure claims to map.
58- // Note: email_r will be auto-added by the provider's post-configure step.
59- void ConfigureServices ( IServiceCollection services ) => services . PostConfigureAll < EtsyAuthenticationOptions > ( o =>
60- {
61- o . IncludeDetailedUserInfo = true ;
62-
63- // Ensure the required scope is present before Validate() executes.
64- // BUG: This should not be necessary as the post-configure should add it. Assuming test Arrange should simulate eventual user setup.
65- if ( ! o . Scope . Contains ( Scopes . EmailRead ) )
66- {
67- o . Scope . Add ( Scopes . EmailRead ) ;
68- o . ClaimActions . MapJsonKey ( ClaimTypes . Email , "primary_email" ) ;
69- o . ClaimActions . MapJsonKey ( ClaimTypes . GivenName , "first_name" ) ;
70- o . ClaimActions . MapJsonKey ( ClaimTypes . Surname , "last_name" ) ;
71- }
72-
73- // Opt-in to include image claim (not auto-mapped by provider to reduce payload size)
74- o . ClaimActions . MapImageClaim ( ) ;
75- } ) ;
52+ static void ConfigureServices ( IServiceCollection services ) => services . PostConfigureAll < EtsyAuthenticationOptions > ( o => o . IncludeDetailedUserInfo = true ) ;
7653
7754 using var server = CreateTestServer ( ConfigureServices ) ;
7855
0 commit comments