Skip to content

Commit edeb1f5

Browse files
committed
Use flight mock provider instead of swizzling
1 parent 995dd51 commit edeb1f5

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

IdentityCore/tests/MSIDWorkPlaceJoinUtilTests.m

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#import "MSIDWorkPlaceJoinUtilBase+Internal.h"
3535
#import "MSIDWPJMetadata.h"
3636
#import "MSIDFlightManager.h"
37+
#import "MSIDFlightManagerMockProvider.h"
3738
#import "MSIDConstants.h"
3839

3940
@interface MSIDWorkPlaceJoinUtilTests : XCTestCase
@@ -69,7 +70,7 @@ - (void)setUp
6970
// Setting use iOS style keychain to true by default. Set it to NO in test cases that require ACL.
7071
self.useIosStyleKeychain = YES;
7172
self.tenantId = NSUUID.UUID.UUIDString;
72-
[self swizzleFlight];
73+
[self mockFlightValues];
7374
#if TARGET_OS_OSX
7475
self.useIosStyleKeychain = NO;
7576
#endif
@@ -852,18 +853,10 @@ - (void)insertEccStkKeyForTenantIdentifier:(NSString *)tenantIdentifier
852853
accessGroup:keychainGroup];
853854
}
854855

855-
- (void)swizzleFlight
856+
- (void)mockFlightValues
856857
{
857-
[MSIDTestSwizzle instanceMethod:@selector(boolForKey:)
858-
class:[MSIDFlightManager class]
859-
block:(id)^(NSString *flightKey)
860-
{
861-
if ([flightKey isEqualToString:MSID_FLIGHT_ENABLE_QUERYING_STK])
862-
{
863-
return YES;
864-
}
865-
return NO;
866-
}];
867-
858+
MSIDFlightManagerMockProvider *flightProvider = [MSIDFlightManagerMockProvider new];
859+
flightProvider.boolForKeyContainer = @{ MSID_FLIGHT_ENABLE_QUERYING_STK: @YES };
860+
MSIDFlightManager.sharedInstance.flightProvider = flightProvider;
868861
}
869862
@end

0 commit comments

Comments
 (0)