FIRSetAccountInfoResponseTests.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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 kAllowedTimeDifference
  132. @brief Allowed difference when comparing times because of execution time and floating point
  133. error.
  134. */
  135. static const double kAllowedTimeDifference = 0.1;
  136. /** @class FIRSetAccountInfoResponseTests
  137. @brief Tests for @c FIRSetAccountInfoResponse.
  138. */
  139. @interface FIRSetAccountInfoResponseTests : XCTestCase
  140. @end
  141. @implementation FIRSetAccountInfoResponseTests {
  142. /** @var _RPCIssuer
  143. @brief This backend RPC issuer is used to fake network responses for each test in the suite.
  144. In the @c setUp method we initialize this and set @c FIRAuthBackend's RPC issuer to it.
  145. */
  146. FIRFakeBackendRPCIssuer *_RPCIssuer;
  147. }
  148. - (void)setUp {
  149. [super setUp];
  150. FIRFakeBackendRPCIssuer *RPCIssuer = [[FIRFakeBackendRPCIssuer alloc] init];
  151. [FIRAuthBackend setDefaultBackendImplementationWithRPCIssuer:RPCIssuer];
  152. _RPCIssuer = RPCIssuer;
  153. }
  154. - (void)tearDown {
  155. _RPCIssuer = nil;
  156. [FIRAuthBackend setDefaultBackendImplementationWithRPCIssuer:nil];
  157. [super tearDown];
  158. }
  159. /** @fn testEmailExistsError
  160. @brief This test simulates @c testSignUpNewUserEmailExistsError with @c
  161. FIRAuthErrorCodeEmailExists error.
  162. */
  163. - (void)testEmailExistsError {
  164. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  165. __block BOOL callbackInvoked;
  166. __block FIRSetAccountInfoResponse *RPCResponse;
  167. __block NSError *RPCError;
  168. [FIRAuthBackend setAccountInfo:request
  169. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  170. NSError *_Nullable error) {
  171. callbackInvoked = YES;
  172. RPCResponse = response;
  173. RPCError = error;
  174. }];
  175. [_RPCIssuer respondWithServerErrorMessage:kEmailExistsErrorMessage];
  176. XCTAssert(callbackInvoked);
  177. XCTAssertNil(RPCResponse);
  178. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeEmailAlreadyInUse);
  179. }
  180. /** @fn testEmailSignUpNotAllowedError
  181. @brief This test simulates @c testEmailSignUpNotAllowedError with @c
  182. FIRAuthErrorCodeOperationNotAllowed error.
  183. */
  184. - (void)testEmailSignUpNotAllowedError {
  185. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  186. __block BOOL callbackInvoked;
  187. __block FIRSetAccountInfoResponse *RPCResponse;
  188. __block NSError *RPCError;
  189. [FIRAuthBackend setAccountInfo:request
  190. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  191. NSError *_Nullable error) {
  192. callbackInvoked = YES;
  193. RPCResponse = response;
  194. RPCError = error;
  195. }];
  196. [_RPCIssuer respondWithServerErrorMessage:kEmailSignUpNotAllowedErrorMessage];
  197. XCTAssert(callbackInvoked);
  198. XCTAssertNil(RPCResponse);
  199. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeOperationNotAllowed);
  200. }
  201. /** @fn testPasswordLoginDisabledError
  202. @brief This test simulates @c passwordLoginDisabledError with @c
  203. FIRAuthErrorCodeOperationNotAllowed error.
  204. */
  205. - (void)testPasswordLoginDisabledError {
  206. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  207. __block BOOL callbackInvoked;
  208. __block FIRSetAccountInfoResponse *RPCResponse;
  209. __block NSError *RPCError;
  210. [FIRAuthBackend setAccountInfo:request
  211. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  212. NSError *_Nullable error) {
  213. callbackInvoked = YES;
  214. RPCResponse = response;
  215. RPCError = error;
  216. }];
  217. [_RPCIssuer respondWithServerErrorMessage:kPasswordLoginDisabledErrorMessage];
  218. XCTAssert(callbackInvoked);
  219. XCTAssertNil(RPCResponse);
  220. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeOperationNotAllowed);
  221. }
  222. /** @fn testUserDisabledError
  223. @brief This test simulates @c testUserDisabledError with @c FIRAuthErrorCodeUserDisabled error.
  224. */
  225. - (void)testUserDisabledError {
  226. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  227. __block BOOL callbackInvoked;
  228. __block FIRSetAccountInfoResponse *RPCResponse;
  229. __block NSError *RPCError;
  230. [FIRAuthBackend setAccountInfo:request
  231. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  232. NSError *_Nullable error) {
  233. callbackInvoked = YES;
  234. RPCResponse = response;
  235. RPCError = error;
  236. }];
  237. [_RPCIssuer respondWithServerErrorMessage:kUserDisabledErrorMessage];
  238. XCTAssert(callbackInvoked);
  239. XCTAssertNil(RPCResponse);
  240. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeUserDisabled);
  241. }
  242. /** @fn testInvalidUserTokenError
  243. @brief This test simulates @c testinvalidUserTokenError with @c
  244. FIRAuthErrorCodeCredentialTooOld error.
  245. */
  246. - (void)testInvalidUserTokenError {
  247. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  248. __block BOOL callbackInvoked;
  249. __block FIRSetAccountInfoResponse *RPCResponse;
  250. __block NSError *RPCError;
  251. [FIRAuthBackend setAccountInfo:request
  252. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  253. NSError *_Nullable error) {
  254. callbackInvoked = YES;
  255. RPCResponse = response;
  256. RPCError = error;
  257. }];
  258. [_RPCIssuer respondWithServerErrorMessage:kinvalidUserTokenErrorMessage];
  259. XCTAssert(callbackInvoked);
  260. XCTAssertNil(RPCResponse);
  261. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidUserToken);
  262. }
  263. /** @fn testrequiresRecentLogin
  264. @brief This test simulates @c testCredentialTooOldError with @c
  265. FIRAuthErrorCodeRequiresRecentLogin error.
  266. */
  267. - (void)testrequiresRecentLogin {
  268. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  269. __block BOOL callbackInvoked;
  270. __block FIRSetAccountInfoResponse *RPCResponse;
  271. __block NSError *RPCError;
  272. [FIRAuthBackend setAccountInfo:request
  273. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  274. NSError *_Nullable error) {
  275. callbackInvoked = YES;
  276. RPCResponse = response;
  277. RPCError = error;
  278. }];
  279. [_RPCIssuer respondWithServerErrorMessage:kCredentialTooOldErrorMessage];
  280. XCTAssert(callbackInvoked);
  281. XCTAssertNil(RPCResponse);
  282. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeRequiresRecentLogin);
  283. }
  284. /** @fn testWeakPasswordError
  285. @brief This test simulates @c FIRAuthErrorCodeWeakPassword error.
  286. */
  287. - (void)testWeakPasswordError {
  288. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  289. __block BOOL callbackInvoked;
  290. __block FIRSetAccountInfoResponse *RPCResponse;
  291. __block NSError *RPCError;
  292. [FIRAuthBackend setAccountInfo:request
  293. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  294. NSError *_Nullable error) {
  295. callbackInvoked = YES;
  296. RPCResponse = response;
  297. RPCError = error;
  298. }];
  299. [_RPCIssuer respondWithServerErrorMessage:kWeakPasswordErrorMessage];
  300. XCTAssert(callbackInvoked);
  301. XCTAssertNil(RPCResponse);
  302. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeWeakPassword);
  303. XCTAssertEqualObjects(RPCError.userInfo[NSLocalizedFailureReasonErrorKey],
  304. kWeakPasswordClientErrorMessage);
  305. }
  306. /** @fn testInvalidEmailError
  307. @brief This test simulates @c FIRAuthErrorCodeInvalidEmail error code.
  308. */
  309. - (void)testInvalidEmailError {
  310. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  311. __block BOOL callbackInvoked;
  312. __block FIRSetAccountInfoResponse *RPCResponse;
  313. __block NSError *RPCError;
  314. [FIRAuthBackend setAccountInfo:request
  315. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  316. NSError *_Nullable error) {
  317. callbackInvoked = YES;
  318. RPCResponse = response;
  319. RPCError = error;
  320. }];
  321. [_RPCIssuer respondWithServerErrorMessage:kInvalidEmailErrorMessage];
  322. XCTAssert(callbackInvoked);
  323. XCTAssertNil(RPCResponse);
  324. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidEmail);
  325. }
  326. /** @fn testInvalidActionCodeError
  327. @brief This test simulates @c FIRAuthErrorCodeInvalidActionCode error code.
  328. */
  329. - (void)testInvalidActionCodeError {
  330. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  331. __block BOOL callbackInvoked;
  332. __block FIRSetAccountInfoResponse *RPCResponse;
  333. __block NSError *RPCError;
  334. [FIRAuthBackend setAccountInfo:request
  335. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  336. NSError *_Nullable error) {
  337. callbackInvoked = YES;
  338. RPCResponse = response;
  339. RPCError = error;
  340. }];
  341. [_RPCIssuer respondWithServerErrorMessage:kInvalidActionCodeErrorMessage];
  342. XCTAssert(callbackInvoked);
  343. XCTAssertNil(RPCResponse);
  344. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidActionCode);
  345. }
  346. /** @fn testExpiredActionCodeError
  347. @brief This test simulates @c FIRAuthErrorCodeExpiredActionCode error code.
  348. */
  349. - (void)testExpiredActionCodeError {
  350. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  351. __block BOOL callbackInvoked;
  352. __block FIRSetAccountInfoResponse *RPCResponse;
  353. __block NSError *RPCError;
  354. [FIRAuthBackend setAccountInfo:request
  355. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  356. NSError *_Nullable error) {
  357. callbackInvoked = YES;
  358. RPCResponse = response;
  359. RPCError = error;
  360. }];
  361. [_RPCIssuer respondWithServerErrorMessage:kExpiredActionCodeErrorMessage];
  362. XCTAssert(callbackInvoked);
  363. XCTAssertNil(RPCResponse);
  364. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeExpiredActionCode);
  365. }
  366. /** @fn testInvalidMessagePayloadError
  367. @brief Tests for @c FIRAuthErrorCodeInvalidMessagePayload.
  368. */
  369. - (void)testInvalidMessagePayloadError {
  370. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  371. __block BOOL callbackInvoked;
  372. __block FIRSetAccountInfoResponse *RPCResponse;
  373. __block NSError *RPCError;
  374. [FIRAuthBackend setAccountInfo:request
  375. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  376. NSError *_Nullable error) {
  377. RPCResponse = response;
  378. RPCError = error;
  379. callbackInvoked = YES;
  380. }];
  381. [_RPCIssuer respondWithServerErrorMessage:kInvalidMessagePayloadErrorMessage];
  382. XCTAssert(callbackInvoked);
  383. XCTAssertNil(RPCResponse);
  384. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidMessagePayload);
  385. }
  386. /** @fn testInvalidSenderError
  387. @brief Tests for @c FIRAuthErrorCodeInvalidSender.
  388. */
  389. - (void)testInvalidSenderError {
  390. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  391. __block BOOL callbackInvoked;
  392. __block FIRSetAccountInfoResponse *RPCResponse;
  393. __block NSError *RPCError;
  394. [FIRAuthBackend setAccountInfo:request
  395. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  396. NSError *_Nullable error) {
  397. RPCResponse = response;
  398. RPCError = error;
  399. callbackInvoked = YES;
  400. }];
  401. [_RPCIssuer respondWithServerErrorMessage:kInvalidSenderErrorMessage];
  402. XCTAssert(callbackInvoked);
  403. XCTAssertNil(RPCResponse);
  404. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidSender);
  405. }
  406. /** @fn testInvalidRecipientEmailError
  407. @brief Tests for @c FIRAuthErrorCodeInvalidRecipientEmail.
  408. */
  409. - (void)testInvalidRecipientEmailError {
  410. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  411. __block BOOL callbackInvoked;
  412. __block FIRSetAccountInfoResponse *RPCResponse;
  413. __block NSError *RPCError;
  414. [FIRAuthBackend setAccountInfo:request
  415. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  416. NSError *_Nullable error) {
  417. RPCResponse = response;
  418. RPCError = error;
  419. callbackInvoked = YES;
  420. }];
  421. [_RPCIssuer respondWithServerErrorMessage:kInvalidRecipientEmailErrorMessage];
  422. XCTAssert(callbackInvoked);
  423. XCTAssertNil(RPCResponse);
  424. XCTAssertEqual(RPCError.code, FIRAuthErrorCodeInvalidRecipientEmail);
  425. }
  426. /** @fn testSuccessfulSetAccountInfoResponse
  427. @brief This test simulates a successful @c SetAccountInfo flow.
  428. */
  429. - (void)testSuccessfulSetAccountInfoResponse {
  430. FIRSetAccountInfoRequest *request = [[FIRSetAccountInfoRequest alloc] initWithAPIKey:kTestAPIKey];
  431. __block BOOL callbackInvoked;
  432. __block FIRSetAccountInfoResponse *RPCResponse;
  433. __block NSError *RPCError;
  434. [FIRAuthBackend setAccountInfo:request
  435. callback:^(FIRSetAccountInfoResponse *_Nullable response,
  436. NSError *_Nullable error) {
  437. callbackInvoked = YES;
  438. RPCResponse = response;
  439. RPCError = error;
  440. }];
  441. [_RPCIssuer respondWithJSON:@{
  442. kProviderUserInfoKey:@[
  443. @{ kPhotoUrlKey : kTestPhotoURL }
  444. ],
  445. kIDTokenKey : kTestIDToken,
  446. kExpiresInKey : kTestExpiresIn,
  447. kRefreshTokenKey : kTestRefreshToken
  448. }];
  449. XCTAssert(callbackInvoked);
  450. XCTAssertNil(RPCError);
  451. XCTAssertNotNil(RPCResponse);
  452. if ([RPCResponse.providerUserInfo count]) {
  453. NSURL *responsePhotoUrl = RPCResponse.providerUserInfo[0].photoURL;
  454. XCTAssertEqualObjects(responsePhotoUrl.absoluteString, kTestPhotoURL);
  455. }
  456. XCTAssertEqualObjects(RPCResponse.IDToken, kTestIDToken);
  457. NSTimeInterval expiresIn = [RPCResponse.approximateExpirationDate timeIntervalSinceNow];
  458. XCTAssertEqualWithAccuracy(expiresIn, [kTestExpiresIn doubleValue], kAllowedTimeDifference);
  459. XCTAssertEqualObjects(RPCResponse.refreshToken, kTestRefreshToken);
  460. }
  461. @end