MCPlusAPIClientTests.swift 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // MCPlusAPIClientTests.swift
  3. // MCPlusTests
  4. //
  5. // Created by seo ha on 19/03/2019.
  6. // Copyright © 2019 KangSH. All rights reserved.
  7. //
  8. import XCTest
  9. @testable import kunkuk
  10. class MCPlusAPIClientTests: XCTestCase {
  11. override func setUp() {
  12. // Put setup code here. This method is called before the invocation of each test method in the class.
  13. }
  14. override func tearDown() {
  15. // Put teardown code here. This method is called after the invocation of each test method in the class.
  16. }
  17. func testVersionCheck(){
  18. // given
  19. let promise = expectation(description: "Status code: 200")
  20. // when
  21. var param = [String:Any]()
  22. param["platformType"] = Constants.PLATFORM_TYPE
  23. param["appName"] = MCarePlusConstants.APP_NAME
  24. param["certType"] = MCarePlusConstants.CERT_TYPE
  25. var isSuccess = false
  26. APIClient("\(MCarePlusConstants.DOMAIN_NAME)\(MCarePlusConstants.APP_NAME)\(Constants.API_TYPE_VERSION_CHECK).json")
  27. .param(reqParam: param)
  28. .enType(.json)
  29. .connect { (result:[String:Any]) in
  30. let versionOrder = result["versionOrder"] as? Float ?? 0
  31. if versionOrder > 0{
  32. isSuccess = true
  33. }
  34. promise.fulfill()
  35. }
  36. waitForExpectations(timeout: 5, handler: nil)
  37. //then
  38. XCTAssertTrue(isSuccess)
  39. }
  40. }