FIRSetAccountInfoResponseTests.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <XCTest/XCTest.h>
  17. #import "FIRAuthErrors.h"
  18. #import "FIRAuthBackend.h"
  19. #import "FIRSetAccountInfoRequest.h"
  20. #import "FIRSetAccountInfoResponse.h"
  21. #import "FIRFakeBackendRPCIssuer.h"
  22. /** @var kTestAPIKey
  23. @brief Fake API key used for testing.
  24. */
  25. static NSString *const kTestAPIKey = @"APIKey";
  26. /** @var kEmailExistsErrorMessage
  27. @brief This is the error message the server will respond with if the user entered an invalid
  28. email address.
  29. */
  30. static NSString *const kEmailExistsErrorMessage = @"EMAIL_EXISTS";
  31. /** @var kVerifiedProviderKey
  32. @brief The name of the "VerifiedProvider" property in the response.
  33. */
  34. static NSString *const kProviderUserInfoKey = @"providerUserInfo";
  35. /** @var kPhotoUrlKey
  36. @brief The name of the "photoURL" property in the response.
  37. */
  38. static NSString *const kPhotoUrlKey = @"photoUrl";
  39. /** @var kTestPhotoURL
  40. @brief The fake photoUrl property value in the response.
  41. */
  42. static NSString *const kTestPhotoURL = @"testPhotoURL";
  43. /** @var kIDTokenKey
  44. @brief The name of the "IDToken" property in the response.
  45. */
  46. static NSString *const kIDTokenKey = @"idToken";
  47. /** @var kTestIDToken
  48. @brief Testing ID token for verifying assertion.
  49. */
  50. static NSString *const kTestIDToken = @"ID_TOKEN";
  51. /** @var kExpiresInKey
  52. @brief The name of the "expiresIn" property in the response.
  53. */
  54. static NSString *const kExpiresInKey = @"expiresIn";
  55. /** @var kTestExpiresIn
  56. @brief Fake token expiration time.
  57. */
  58. static NSString *const kTestExpiresIn = @"12345";
  59. /** @var kRefreshTokenKey
  60. @brief The name of the "refreshToken" property in the response.
  61. */
  62. static NSString *const kRefreshTokenKey = @"refreshToken";
  63. /** @var kTestRefreshToken
  64. @brief Fake refresh token.
  65. */
  66. static NSString *const kTestRefreshToken = @"REFRESH_TOKEN";
  67. /** @var kEmailSignUpNotAllowedErrorMessage
  68. @brief This is the error message the server will respond with if admin disables password
  69. account.
  70. */
  71. static NSString *const kEmailSignUpNotAllowedErrorMessage = @"OPERATION_NOT_ALLOWED";
  72. /** @var kPasswordLoginDisabledErrorMessage
  73. @brief This is the error message the server responds with if password login is disabled.
  74. */
  75. static NSString *const kPasswordLoginDisabledErrorMessage = @"PASSWORD_LOGIN_DISABLED";
  76. /** @var kCredentialTooOldErrorMessage
  77. @brief This is the error message the server responds with if account change is attempted 5
  78. minutes after signing in.
  79. */
  80. static NSString *const kCredentialTooOldErrorMessage = @"CREDENTIAL_TOO_OLD_LOGIN_AGAIN";
  81. /** @var kinvalidUserTokenErrorMessage
  82. @brief This is the error message the server will respond with if the user's saved auth
  83. credential is invalid, the user has to sign-in again.
  84. */
  85. static NSString *const kinvalidUserTokenErrorMessage = @"INVALID_ID_TOKEN";
  86. /** @var kUserDisabledErrorMessage
  87. @brief This is the error message the server will respond with if the user's account has been
  88. disabled.
  89. */
  90. static NSString *const kUserDisabledErrorMessage = @"USER_DISABLED";
  91. /** @var kInvalidEmailErrorMessage
  92. @brief The error returned by the server if the email is invalid.
  93. */
  94. static NSString *const kInvalidEmailErrorMessage = @"INVALID_EMAIL";
  95. /** @var kWeakPasswordErrorMessage
  96. @brief This is the error message the server will respond with if the user's new password
  97. is too weak that it is too short.
  98. */
  99. static NSString *const kWeakPasswordErrorMessage =
  100. @"WEAK_PASSWORD : Password should be at least 6 characters";
  101. /** @var kWeakPasswordClientErrorMessage
  102. @brief This is the error message the client will see if the user's new password is too weak
  103. that it is too short.
  104. @remarks This message should be derived from @c kWeakPasswordErrorMessage .
  105. */
  106. static NSString *const kWeakPasswordClientErrorMessage =
  107. @"Password should be at least 6 characters";
  108. /** @var kExpiredActionCodeErrorMessage
  109. @brief This is the error message the server will respond with if the action code is expired.
  110. */
  111. static NSString *const kExpiredActionCodeErrorMessage = @"EXPIRED_OOB_CODE:";
  112. /** @var kInvalidActionCodeErrorMessage
  113. @brief This is the error message the server will respond with if the action code is invalid.
  114. */
  115. static NSString *const kInvalidActionCodeErrorMessage = @"INVALID_OOB_CODE";
  116. /** @var kInvalidMessagePayloadErrorMessage
  117. @brief This is the prefix for the error message the server responds with if an invalid message
  118. payload was sent.
  119. */
  120. static NSString *const kInvalidMessagePayloadErrorMessage = @"INVALID_MESSAGE_PAYLOAD";
  121. /** @var kInvalidSenderErrorMessage
  122. @brief This is the prefix for the error message the server responds with if invalid sender is
  123. used to send the email for updating user's email address.
  124. */
  125. static NSString *const kInvalidSenderErrorMessage = @"INVALID_SENDER";
  126. /** @var kInvalidRecipientEmailErrorMessage
  127. @brief This is the prefix for the error message the server responds with if the recipient email
  128. is invalid.
  129. */
  130. static NSString *const kInvalidRecipientEmailErrorMessage = @"INVALID_RECIPIENT_EMAIL";
  131. /** @var kEpsilon
  132. @brief Allowed difference when comparing floating point numbers.
  133. */
  134. static const double kEpsilon = 1e-3;
  135. /** @class FIRSetAccountInfoResponseTests
  136. @brief Tests for @c FIRSetAccountInfoResponse.
  137. */
  138. @interface FIRSetAccountInfoResponseTests : XCTestCase
  139. @end
  140. @implementation FIRSetAccountInfoResponseTests {
  141. /** @var _RPCIssuer
  142. @brief This backend RPC issuer is used to fake network responses for each test in the suite.
  143. In the @c setUp method we initialize this and set @c FIRAuthBackend's RPC issuer to it.
  144. */
  145. FIRFakeBackendRPCIssuer *_RPCIssuer;
  146. }
  147. - (void)setUp {
  148. [super setUp];
  149. FIRFakeBackendRPCIssuer *RPCIssuer = [[FIRFakeBackendRPCIssuer alloc] init];
  150. [FIRAuthBackend setDefaultBackendImplementationWithRPCIssuer:RPCIssuer];
  151. _RPCIssuer = RPCIssuer;
  152. }
  153. - (void)tearDown {
  154. _RPCIssuer = nil;
  155. [FIRAuthBackend setDefaultBackendImplementationWithRPCIssuer:nil];
  156. [super tearDown];
  157. }
  158. /** @fn testEmailExistsError
  159. @brief This test simulates @c testSignUpNewUserEmailExistsError with @c
  160. FIRAuthErrorCodeEmailExists error.
  161. */
  162. - (void)testEmailExistsError {
  163. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  164. __block BOOL callbackInvoked;
  165. __block FIRSetAccountInfoResponse *RPCResponse;
  166. __block NSError *RPCError;
  167. [FIRAuthBackend setAccountInfo:request
  168. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  169. NSError *_Nullable error) {
  170. callbackInvoked = YES;
  171. RPCResponse = response;
  172. RPCError = error;
  173. }];
  174. [_RPCIssuer respondWithServerErrorMessage:kEmailExistsErrorMessage];
  175. XCTAssert(callbackInvoked);
  176. XCTAssertNil(RPCResponse);
  177. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeEmailAlreadyInUse);
  178. }
  179. /** @fn testEmailSignUpNotAllowedError
  180. @brief This test simulates @c testEmailSignUpNotAllowedError with @c
  181. FIRAuthErrorCodeOperationNotAllowed error.
  182. */
  183. - (void)testEmailSignUpNotAllowedError {
  184. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  185. __block BOOL callbackInvoked;
  186. __block FIRSetAccountInfoResponse *RPCResponse;
  187. __block NSError *RPCError;
  188. [FIRAuthBackend setAccountInfo:request
  189. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  190. NSError *_Nullable error) {
  191. callbackInvoked = YES;
  192. RPCResponse = response;
  193. RPCError = error;
  194. }];
  195. [_RPCIssuer respondWithServerErrorMessage:kEmailSignUpNotAllowedErrorMessage];
  196. XCTAssert(callbackInvoked);
  197. XCTAssertNil(RPCResponse);
  198. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeOperationNotAllowed);
  199. }
  200. /** @fn testPasswordLoginDisabledError
  201. @brief This test simulates @c passwordLoginDisabledError with @c
  202. FIRAuthErrorCodeOperationNotAllowed error.
  203. */
  204. - (void)testPasswordLoginDisabledError {
  205. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  206. __block BOOL callbackInvoked;
  207. __block FIRSetAccountInfoResponse *RPCResponse;
  208. __block NSError *RPCError;
  209. [FIRAuthBackend setAccountInfo:request
  210. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  211. NSError *_Nullable error) {
  212. callbackInvoked = YES;
  213. RPCResponse = response;
  214. RPCError = error;
  215. }];
  216. [_RPCIssuer respondWithServerErrorMessage:kPasswordLoginDisabledErrorMessage];
  217. XCTAssert(callbackInvoked);
  218. XCTAssertNil(RPCResponse);
  219. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeOperationNotAllowed);
  220. }
  221. /** @fn testUserDisabledError
  222. @brief This test simulates @c testUserDisabledError with @c FIRAuthErrorCodeUserDisabled error.
  223. */
  224. - (void)testUserDisabledError {
  225. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  226. __block BOOL callbackInvoked;
  227. __block FIRSetAccountInfoResponse *RPCResponse;
  228. __block NSError *RPCError;
  229. [FIRAuthBackend setAccountInfo:request
  230. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  231. NSError *_Nullable error) {
  232. callbackInvoked = YES;
  233. RPCResponse = response;
  234. RPCError = error;
  235. }];
  236. [_RPCIssuer respondWithServerErrorMessage:kUserDisabledErrorMessage];
  237. XCTAssert(callbackInvoked);
  238. XCTAssertNil(RPCResponse);
  239. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeUserDisabled);
  240. }
  241. /** @fn testInvalidUserTokenError
  242. @brief This test simulates @c testinvalidUserTokenError with @c
  243. FIRAuthErrorCodeCredentialTooOld error.
  244. */
  245. - (void)testInvalidUserTokenError {
  246. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  247. __block BOOL callbackInvoked;
  248. __block FIRSetAccountInfoResponse *RPCResponse;
  249. __block NSError *RPCError;
  250. [FIRAuthBackend setAccountInfo:request
  251. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  252. NSError *_Nullable error) {
  253. callbackInvoked = YES;
  254. RPCResponse = response;
  255. RPCError = error;
  256. }];
  257. [_RPCIssuer respondWithServerErrorMessage:kinvalidUserTokenErrorMessage];
  258. XCTAssert(callbackInvoked);
  259. XCTAssertNil(RPCResponse);
  260. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidUserToken);
  261. }
  262. /** @fn testrequiresRecentLogin
  263. @brief This test simulates @c testCredentialTooOldError with @c
  264. FIRAuthErrorCodeRequiresRecentLogin error.
  265. */
  266. - (void)testrequiresRecentLogin {
  267. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  268. __block BOOL callbackInvoked;
  269. __block FIRSetAccountInfoResponse *RPCResponse;
  270. __block NSError *RPCError;
  271. [FIRAuthBackend setAccountInfo:request
  272. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  273. NSError *_Nullable error) {
  274. callbackInvoked = YES;
  275. RPCResponse = response;
  276. RPCError = error;
  277. }];
  278. [_RPCIssuer respondWithServerErrorMessage:kCredentialTooOldErrorMessage];
  279. XCTAssert(callbackInvoked);
  280. XCTAssertNil(RPCResponse);
  281. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeRequiresRecentLogin);
  282. }
  283. /** @fn testWeakPasswordError
  284. @brief This test simulates @c FIRAuthErrorCodeWeakPassword error.
  285. */
  286. - (void)testWeakPasswordError {
  287. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  288. __block BOOL callbackInvoked;
  289. __block FIRSetAccountInfoResponse *RPCResponse;
  290. __block NSError *RPCError;
  291. [FIRAuthBackend setAccountInfo:request
  292. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  293. NSError *_Nullable error) {
  294. callbackInvoked = YES;
  295. RPCResponse = response;
  296. RPCError = error;
  297. }];
  298. [_RPCIssuer respondWithServerErrorMessage:kWeakPasswordErrorMessage];
  299. XCTAssert(callbackInvoked);
  300. XCTAssertNil(RPCResponse);
  301. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeWeakPassword);
  302. XCTAssertEqualObjects(RPCError.userInfo[NSLocalizedFailureReasonErrorKey],
  303. kWeakPasswordClientErrorMessage);
  304. }
  305. /** @fn testInvalidEmailError
  306. @brief This test simulates @c FIRAuthErrorCodeInvalidEmail error code.
  307. */
  308. - (void)testInvalidEmailError {
  309. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  310. __block BOOL callbackInvoked;
  311. __block FIRSetAccountInfoResponse *RPCResponse;
  312. __block NSError *RPCError;
  313. [FIRAuthBackend setAccountInfo:request
  314. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  315. NSError *_Nullable error) {
  316. callbackInvoked = YES;
  317. RPCResponse = response;
  318. RPCError = error;
  319. }];
  320. [_RPCIssuer respondWithServerErrorMessage:kInvalidEmailErrorMessage];
  321. XCTAssert(callbackInvoked);
  322. XCTAssertNil(RPCResponse);
  323. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidEmail);
  324. }
  325. /** @fn testInvalidActionCodeError
  326. @brief This test simulates @c FIRAuthErrorCodeInvalidActionCode error code.
  327. */
  328. - (void)testInvalidActionCodeError {
  329. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  330. __block BOOL callbackInvoked;
  331. __block FIRSetAccountInfoResponse *RPCResponse;
  332. __block NSError *RPCError;
  333. [FIRAuthBackend setAccountInfo:request
  334. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  335. NSError *_Nullable error) {
  336. callbackInvoked = YES;
  337. RPCResponse = response;
  338. RPCError = error;
  339. }];
  340. [_RPCIssuer respondWithServerErrorMessage:kInvalidActionCodeErrorMessage];
  341. XCTAssert(callbackInvoked);
  342. XCTAssertNil(RPCResponse);
  343. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidActionCode);
  344. }
  345. /** @fn testExpiredActionCodeError
  346. @brief This test simulates @c FIRAuthErrorCodeExpiredActionCode error code.
  347. */
  348. - (void)testExpiredActionCodeError {
  349. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  350. __block BOOL callbackInvoked;
  351. __block FIRSetAccountInfoResponse *RPCResponse;
  352. __block NSError *RPCError;
  353. [FIRAuthBackend setAccountInfo:request
  354. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  355. NSError *_Nullable error) {
  356. callbackInvoked = YES;
  357. RPCResponse = response;
  358. RPCError = error;
  359. }];
  360. [_RPCIssuer respondWithServerErrorMessage:kExpiredActionCodeErrorMessage];
  361. XCTAssert(callbackInvoked);
  362. XCTAssertNil(RPCResponse);
  363. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeExpiredActionCode);
  364. }
  365. /** @fn testInvalidMessagePayloadError
  366. @brief Tests for @c FIRAuthErrorCodeInvalidMessagePayload.
  367. */
  368. - (void)testInvalidMessagePayloadError {
  369. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  370. __block BOOL callbackInvoked;
  371. __block FIRSetAccountInfoResponse *RPCResponse;
  372. __block NSError *RPCError;
  373. [FIRAuthBackend setAccountInfo:request
  374. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  375. NSError *_Nullable error) {
  376. RPCResponse = response;
  377. RPCError = error;
  378. callbackInvoked = YES;
  379. }];
  380. [_RPCIssuer respondWithServerErrorMessage:kInvalidMessagePayloadErrorMessage];
  381. XCTAssert(callbackInvoked);
  382. XCTAssertNil(RPCResponse);
  383. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidMessagePayload);
  384. }
  385. /** @fn testInvalidSenderError
  386. @brief Tests for @c FIRAuthErrorCodeInvalidSender.
  387. */
  388. - (void)testInvalidSenderError {
  389. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  390. __block BOOL callbackInvoked;
  391. __block FIRSetAccountInfoResponse *RPCResponse;
  392. __block NSError *RPCError;
  393. [FIRAuthBackend setAccountInfo:request
  394. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  395. NSError *_Nullable error) {
  396. RPCResponse = response;
  397. RPCError = error;
  398. callbackInvoked = YES;
  399. }];
  400. [_RPCIssuer respondWithServerErrorMessage:kInvalidSenderErrorMessage];
  401. XCTAssert(callbackInvoked);
  402. XCTAssertNil(RPCResponse);
  403. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidSender);
  404. }
  405. /** @fn testInvalidRecipientEmailError
  406. @brief Tests for @c FIRAuthErrorCodeInvalidRecipientEmail.
  407. */
  408. - (void)testInvalidRecipientEmailError {
  409. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  410. __block BOOL callbackInvoked;
  411. __block FIRSetAccountInfoResponse *RPCResponse;
  412. __block NSError *RPCError;
  413. [FIRAuthBackend setAccountInfo:request
  414. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  415. NSError *_Nullable error) {
  416. RPCResponse = response;
  417. RPCError = error;
  418. callbackInvoked = YES;
  419. }];
  420. [_RPCIssuer respondWithServerErrorMessage:kInvalidRecipientEmailErrorMessage];
  421. XCTAssert(callbackInvoked);
  422. XCTAssertNil(RPCResponse);
  423. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidRecipientEmail);
  424. }
  425. /** @fn testSuccessfulSetAccountInfoResponse
  426. @brief This test simulates a successful @c SetAccountInfo flow.
  427. */
  428. - (void)testSuccessfulSetAccountInfoResponse {
  429. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  430. __block BOOL callbackInvoked;
  431. __block FIRSetAccountInfoResponse *RPCResponse;
  432. __block NSError *RPCError;
  433. [FIRAuthBackend setAccountInfo:request
  434. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  435. NSError *_Nullable error) {
  436. callbackInvoked = YES;
  437. RPCResponse = response;
  438. RPCError = error;
  439. }];
  440. [_RPCIssuer respondWithJSON:@{
  441. kProviderUserInfoKey:@[
  442. @{ kPhotoUrlKey : kTestPhotoURL }
  443. ],
  444. kIDTokenKey : kTestIDToken,
  445. kExpiresInKey : kTestExpiresIn,
  446. kRefreshTokenKey : kTestRefreshToken
  447. }];
  448. XCTAssert(callbackInvoked);
  449. XCTAssertNil(RPCError);
  450. XCTAssertNotNil(RPCResponse);
  451. if ([RPCResponse.providerUserInfo count]) {
  452. NSURL *responsePhotoUrl = RPCResponse.providerUserInfo[0].photoURL;
  453. XCTAssertEqualObjects(responsePhotoUrl.absoluteString, kTestPhotoURL);
  454. }
  455. XCTAssertEqualObjects(RPCResponse.IDToken, kTestIDToken);
  456. NSTimeInterval expiresIn = [RPCResponse.approximateExpirationDate timeIntervalSinceNow];
  457. XCTAssertLessThanOrEqual(fabs(expiresIn - [kTestExpiresIn doubleValue]), kEpsilon);
  458. XCTAssertEqualObjects(RPCResponse.refreshToken, kTestRefreshToken);
  459. }
  460. @end