Skip to content

Commit

Permalink
Fix Flaky Tests: NameAndRoleClaimDelegates and RoleClaims (#2873)
Browse files Browse the repository at this point in the history
* do not modify static property

* revert src code changes

* Update test to re-set DefaultMapInboundClaims property
  • Loading branch information
kellyyangsong authored Oct 22, 2024
1 parent 69b15a7 commit b5f3756
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.IdentityModel.JsonWebTokens;
Expand Down Expand Up @@ -1154,8 +1153,12 @@ public void MapInboundClaims()

// Check to make sure that setting MapInboundClaims to true initializes the InboundClaimType map with the default mappings if it was previously empty.
Assert.Equal(73, handler.InboundClaimTypeMap.Count);

// Check to make sure that changing the instance property did not alter the static property.
Assert.True(JwtSecurityTokenHandler.DefaultMapInboundClaims == false);

// re-set DefaultMapInboundClaims to true to avoid causing flakiness for other tests.
JwtSecurityTokenHandler.DefaultMapInboundClaims = true;
}

[Theory, MemberData(nameof(ReadTimesExpressedAsDoublesTheoryData), DisableDiscoveryEnumeration = true)]
Expand Down

0 comments on commit b5f3756

Please sign in to comment.