Ver código fonte

Fixed TLS evaluation test that can fail in a different way when behind a proxy.

Christian Noon 9 anos atrás
pai
commit
80f01ba759
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5 3
      Tests/TLSEvaluationTests.swift

+ 5 - 3
Tests/TLSEvaluationTests.swift

@@ -93,10 +93,12 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
         waitForExpectationsWithTimeout(timeout, handler: nil)
 
         // Then
-        XCTAssertNotNil(error, "error should not be nil")
+        XCTAssertNotNil(error)
 
-        if let code = error?.code {
-            XCTAssertEqual(code, NSURLErrorServerCertificateUntrusted, "code should be untrusted server certficate")
+        if let error = error where error.domain == NSURLErrorDomain {
+            XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted)
+        } else if let error = error where error.domain == (kCFErrorDomainCFNetwork as String) {
+            XCTAssertEqual(error.code, Int(CFNetworkErrors.CFErrorHTTPSProxyConnectionFailure.rawValue))
         } else {
             XCTFail("error should be an NSError")
         }