AppCheckE2ETests.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2023 Google LLC
  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 XCTest
  15. import FirebaseAppCheck
  16. import FirebaseCore
  17. final class AppCheckE2ETests: XCTestCase {
  18. // TODO(andrewheard): Add integration tests that exercise the public API.
  19. let appName = "test_app_name"
  20. var app: FirebaseApp!
  21. override func setUp() {
  22. let options = FirebaseOptions(googleAppID: "1:123456789:ios:abc123", gcmSenderID: "123456789")
  23. options.projectID = "test_project_id"
  24. options.apiKey = "test_api_key"
  25. FirebaseApp.configure(name: appName, options: options)
  26. app = FirebaseApp.app(name: appName)
  27. }
  28. override func tearDown() {
  29. let semaphore = DispatchSemaphore(value: 0)
  30. app.delete { _ in
  31. semaphore.signal()
  32. }
  33. semaphore.wait()
  34. }
  35. func testInitAppCheck() throws {
  36. AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())
  37. let appCheck = AppCheck.appCheck(app: app)
  38. XCTAssertNotNil(appCheck)
  39. }
  40. func testInitAppCheckDebugProvider() throws {
  41. let debugProvider = AppCheckDebugProvider(app: app)
  42. XCTAssertNotNil(debugProvider)
  43. }
  44. }