FIROptionsMock.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2017 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <OCMock/OCMock.h>
  15. #import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
  16. #import "SharedTestUtilities/FIROptionsMock.h"
  17. NSString *const kAndroidClientID = @"correct_android_client_id";
  18. // FIS requires 39 characters starting with A.
  19. NSString *const kAPIKey = @"A23456789012345678901234567890123456789";
  20. NSString *const kCustomizedAPIKey = @"customized_api_key";
  21. NSString *const kClientID = @"correct_client_id";
  22. NSString *const kTrackingID = @"correct_tracking_id";
  23. NSString *const kGCMSenderID = @"correct_gcm_sender_id";
  24. NSString *const kGoogleAppID = @"1:123:ios:123abc";
  25. NSString *const kDatabaseURL = @"https://abc-xyz-123.firebaseio.com";
  26. NSString *const kStorageBucket = @"project-id-123.storage.firebase.com";
  27. NSString *const kDeepLinkURLScheme = @"comgoogledeeplinkurl";
  28. NSString *const kNewDeepLinkURLScheme = @"newdeeplinkurlfortest";
  29. NSString *const kBundleID = @"com.google.FirebaseSDKTests";
  30. NSString *const kProjectID = @"Mocked Project ID";
  31. @interface FIROptionsMock ()
  32. @end
  33. @implementation FIROptionsMock
  34. // Swift Package manager does not allow a test project to override a bundle in an app (or library).
  35. + (void)mockFIROptions {
  36. NSDictionary<NSString *, NSString *> *mockDictionary = @{
  37. kFIRAPIKey : kAPIKey,
  38. kFIRBundleID : kBundleID,
  39. kFIRClientID : kClientID,
  40. kFIRDatabaseURL : kDatabaseURL,
  41. kFIRGCMSenderID : kGCMSenderID,
  42. kFIRGoogleAppID : kGoogleAppID,
  43. kFIRProjectID : kProjectID,
  44. kFIRStorageBucket : kStorageBucket,
  45. kFIRTrackingID : kTrackingID,
  46. };
  47. id optionsClassMock = OCMClassMock([FIROptions class]);
  48. OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
  49. }
  50. @end