@@ -254,85 +254,6 @@ func (s *AuthenticationTestSuite) TestTenancySkipFunctions() {
254254 setup func (context.Context , map [string ]string ) (context.Context , map [string ]string )
255255 checkResult func (* testing.T , context.Context , map [string ]string )
256256 }{
257- {
258- name : "SkipTenancyChecksFromMap with skip_tenancy_check=true should set skip flag" ,
259- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
260- m ["skip_tenancy_check" ] = "true"
261- ctx = security .SkipTenancyChecksFromMap (ctx , m )
262- return ctx , m
263- },
264- checkResult : func (t * testing.T , ctx context.Context , _ map [string ]string ) {
265- require .True (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should be skipped" )
266- },
267- },
268- {
269- name : "SkipTenancyChecksFromMap with skip_tenancy_check=false should not set skip flag" ,
270- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
271- m ["skip_tenancy_check" ] = "false"
272- ctx = security .SkipTenancyChecksFromMap (ctx , m )
273- return ctx , m
274- },
275- checkResult : func (t * testing.T , ctx context.Context , _ map [string ]string ) {
276- require .False (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should not be skipped" )
277- },
278- },
279- {
280- name : "SkipTenancyChecksFromMap without skip_tenancy_check should not set skip flag" ,
281- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
282- ctx = security .SkipTenancyChecksFromMap (ctx , m )
283- return ctx , m
284- },
285- checkResult : func (t * testing.T , ctx context.Context , _ map [string ]string ) {
286- require .False (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should not be skipped" )
287- },
288- },
289- {
290- name : "SkipTenancyChecksFromMap with other values should not set skip flag" ,
291- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
292- m ["skip_tenancy_check" ] = "maybe"
293- m ["other_key" ] = "value"
294- ctx = security .SkipTenancyChecksFromMap (ctx , m )
295- return ctx , m
296- },
297- checkResult : func (t * testing.T , ctx context.Context , _ map [string ]string ) {
298- require .False (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should not be skipped" )
299- },
300- },
301- {
302- name : "SkipTenancyChecksToMap with skip flag should not set skip_tenancy_check in map" ,
303- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
304- ctx = security .SkipTenancyChecksOnClaims (ctx )
305- m = security .SkipTenancyChecksToMap (ctx , m )
306- return ctx , m
307- },
308- checkResult : func (t * testing.T , ctx context.Context , m map [string ]string ) {
309- require .True (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should be skipped" )
310- require .NotContains (t , m , "skip_tenancy_check" , "map should not contain skip_tenancy_check key" )
311- },
312- },
313- {
314- name : "SkipTenancyChecksToMap without skip flag should set skip_tenancy_check=true in map" ,
315- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
316- m = security .SkipTenancyChecksToMap (ctx , m )
317- return ctx , m
318- },
319- checkResult : func (t * testing.T , ctx context.Context , m map [string ]string ) {
320- require .False (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "tenancy checks should not be skipped" )
321- require .Equal (t , "true" , m ["skip_tenancy_check" ], "map should contain skip_tenancy_check=true" )
322- },
323- },
324- {
325- name : "SkipTenancyChecksToMap preserves existing map values" ,
326- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
327- m ["existing_key" ] = "existing_value"
328- m = security .SkipTenancyChecksToMap (ctx , m )
329- return ctx , m
330- },
331- checkResult : func (t * testing.T , _ context.Context , m map [string ]string ) {
332- require .Equal (t , "existing_value" , m ["existing_key" ], "existing map values should be preserved" )
333- require .Equal (t , "true" , m ["skip_tenancy_check" ], "skip_tenancy_check should be set to true" )
334- },
335- },
336257 {
337258 name : "IsTenancyChecksOnClaimSkipped with skip flag returns true" ,
338259 setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
@@ -384,26 +305,6 @@ func (s *AuthenticationTestSuite) TestTenancySkipFunctions() {
384305 )
385306 },
386307 },
387- {
388- name : "Round trip: FromMap -> ToMap preserves skip state" ,
389- setup : func (ctx context.Context , m map [string ]string ) (context.Context , map [string ]string ) {
390- m ["skip_tenancy_check" ] = "true"
391- ctx = security .SkipTenancyChecksFromMap (ctx , m )
392- // Clear the original map and recreate it
393- newMap := make (map [string ]string )
394- newMap = security .SkipTenancyChecksToMap (ctx , newMap )
395- return ctx , newMap
396- },
397- checkResult : func (t * testing.T , ctx context.Context , m map [string ]string ) {
398- require .True (t , security .IsTenancyChecksOnClaimSkipped (ctx ), "context should have skip flag" )
399- require .NotContains (
400- t ,
401- m ,
402- "skip_tenancy_check" ,
403- "map should not contain skip_tenancy_check when context has skip flag" ,
404- )
405- },
406- },
407308 }
408309
409310 for _ , tc := range testCases {
0 commit comments