Skip to content

Commit 63f91a8

Browse files
committed
Cleanup FIRApp Auth Code
This is no longer necessary due to the interop process now being in place. + Deleted `getTokenForcingRefresh:withCallback:` from FIRApp + Deleted `getUID` from FIRApp + Deleted related code from FIRAuth + Deleted tests related to deleted code
1 parent c0d0421 commit 63f91a8

File tree

6 files changed

+2264
-135
lines changed

6 files changed

+2264
-135
lines changed

Example/Auth/Tests/FIRAuthTests.m

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -365,20 +365,6 @@ - (void)testLifeCycle {
365365
XCTAssertNil(auth);
366366
}
367367

368-
/** @fn testGetUID
369-
@brief Verifies that FIRApp's getUIDImplementation is correctly set by FIRAuth.
370-
*/
371-
- (void)testGetUID {
372-
// TODO: Remove this test once Firestore, Database, and Storage move over to the new Auth interop
373-
// library.
374-
FIRApp *app = [FIRApp defaultApp];
375-
XCTAssertNotNil(app.getUIDImplementation);
376-
[[FIRAuth auth] signOut:NULL];
377-
XCTAssertNil(app.getUIDImplementation());
378-
[self waitForSignIn];
379-
XCTAssertEqualObjects(app.getUIDImplementation(), kLocalID);
380-
}
381-
382368
#pragma mark - Server API Tests
383369

384370
/** @fn testFetchProvidersForEmailSuccess
@@ -2277,19 +2263,6 @@ - (void)mockSecureTokenResponseWithError:(nullable NSError *)error {
22772263
});
22782264
}
22792265

2280-
/** @fn enableAutoTokenRefresh
2281-
@brief Enables automatic token refresh by invoking FIRAuth's implementation of FIRApp's
2282-
|getTokenWithImplementation|.
2283-
*/
2284-
- (void)enableAutoTokenRefresh {
2285-
XCTestExpectation *expectation = [self expectationWithDescription:@"autoTokenRefreshcallback"];
2286-
[[FIRAuth auth].app getTokenForcingRefresh:NO withCallback:^(NSString *_Nullable token,
2287-
NSError *_Nullable error) {
2288-
[expectation fulfill];
2289-
}];
2290-
[self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil];
2291-
}
2292-
22932266
/** @fn app1
22942267
@brief Creates a Firebase app.
22952268
@return A @c FIRApp with some name.

Example/Core/Tests/FIRAppTest.m

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -283,59 +283,6 @@ - (void)testErrorForSubspecConfigurationFailure {
283283
XCTAssert([error.description containsString:@"Configuration failed for"]);
284284
}
285285

286-
- (void)testGetTokenWithCallback {
287-
[FIRApp configure];
288-
FIRApp *app = [FIRApp defaultApp];
289-
290-
__block BOOL getTokenImplementationWasCalled = NO;
291-
__block BOOL getTokenCallbackWasCalled = NO;
292-
__block BOOL passedRefreshValue = NO;
293-
294-
[app getTokenForcingRefresh:YES
295-
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
296-
getTokenCallbackWasCalled = YES;
297-
}];
298-
299-
XCTAssert(getTokenCallbackWasCalled,
300-
@"The callback should be invoked by the base implementation when no block for "
301-
"'getTokenImplementation' has been specified.");
302-
303-
getTokenCallbackWasCalled = NO;
304-
305-
app.getTokenImplementation = ^(BOOL refresh, FIRTokenCallback callback) {
306-
getTokenImplementationWasCalled = YES;
307-
passedRefreshValue = refresh;
308-
callback(nil, nil);
309-
};
310-
[app getTokenForcingRefresh:YES
311-
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
312-
getTokenCallbackWasCalled = YES;
313-
}];
314-
315-
XCTAssert(getTokenImplementationWasCalled,
316-
@"The 'getTokenImplementation' block was never called.");
317-
XCTAssert(passedRefreshValue,
318-
@"The value for the 'refresh' parameter wasn't passed to the 'getTokenImplementation' "
319-
"block correctly.");
320-
XCTAssert(getTokenCallbackWasCalled,
321-
@"The 'getTokenImplementation' should have invoked the callback. This could be an "
322-
"error in this test, or the callback parameter may not have been passed to the "
323-
"implementation correctly.");
324-
325-
getTokenImplementationWasCalled = NO;
326-
getTokenCallbackWasCalled = NO;
327-
passedRefreshValue = NO;
328-
329-
[app getTokenForcingRefresh:NO
330-
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
331-
getTokenCallbackWasCalled = YES;
332-
}];
333-
334-
XCTAssertFalse(passedRefreshValue,
335-
@"The value for the 'refresh' parameter wasn't passed to the "
336-
"'getTokenImplementation' block correctly.");
337-
}
338-
339286
- (void)testModifyingOptionsThrows {
340287
[FIRApp configure];
341288
FIROptions *options = [[FIRApp defaultApp] options];
@@ -754,16 +701,6 @@ - (void)testAnalyticsNotSetByGlobalDataCollectionSwitch {
754701

755702
#pragma mark - Internal Methods
756703

757-
// TODO: Remove this test once the `getUIDImplementation` block doesn't need to be set in Core.
758-
- (void)testAuthGetUID {
759-
[FIRApp configure];
760-
761-
[FIRApp defaultApp].getUIDImplementation = ^NSString * {
762-
return @"highlander";
763-
};
764-
XCTAssertEqual([[FIRApp defaultApp] getUID], @"highlander");
765-
}
766-
767704
- (void)testIsAppConfigured {
768705
// Ensure it's false before anything is configured.
769706
XCTAssertFalse([FIRApp isDefaultAppConfigured]);

0 commit comments

Comments
 (0)