BaseXCTestCase.swift 953 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // BaseXCTestCase.swift
  3. // Nextcloud
  4. //
  5. // Created by Milen on 20.03.24.
  6. // Copyright © 2024 Marino Faggiana. All rights reserved.
  7. //
  8. import XCTest
  9. import Foundation
  10. import UIKit
  11. import Alamofire
  12. import NextcloudKit
  13. @testable import Nextcloud
  14. class BaseXCTestCase: XCTestCase {
  15. var appToken = ""
  16. func setupAppToken() {
  17. let expectation = expectation(description: "Should get app token")
  18. NextcloudKit.shared.getAppPassword(url: TestConstants.server, user: TestConstants.username, password: TestConstants.password) { token, _, error in
  19. XCTAssertEqual(error.errorCode, 0)
  20. XCTAssertNotNil(token)
  21. guard let token else { return XCTFail() }
  22. self.appToken = token
  23. expectation.fulfill()
  24. }
  25. waitForExpectations(timeout: TestConstants.timeoutLong)
  26. }
  27. override func setUpWithError() throws {
  28. setupAppToken()
  29. }
  30. }