瀏覽代碼

Fixed issue in TLS tests where root certificate is missing from server trust.

It appears that in iOS 10 and macOS 10.12 that the root certificate is no longer included as part of the server trust object. The root certificate is still included in tvOS 10.0.
Christian Noon 9 年之前
父節點
當前提交
928cdae0c5
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      Tests/TLSEvaluationTests.swift

+ 16 - 0
Tests/TLSEvaluationTests.swift

@@ -294,7 +294,15 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
         waitForExpectations(timeout: timeout, handler: nil)
 
         // Then
+    #if os(iOS) || os(macOS)
+        if #available(iOS 10.0, macOS 10.12.0, *) {
+            XCTAssertNotNil(error, "error should not be nil")
+        } else {
+            XCTAssertNil(error, "error should be nil")
+        }
+    #else
         XCTAssertNil(error, "error should be nil")
+    #endif
     }
 
     // MARK: Server Trust Policy - Public Key Pinning Tests
@@ -414,7 +422,15 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
         waitForExpectations(timeout: timeout, handler: nil)
 
         // Then
+    #if os(iOS) || os(macOS)
+        if #available(iOS 10.0, macOS 10.12.0, *) {
+            XCTAssertNotNil(error, "error should not be nil")
+        } else {
+            XCTAssertNil(error, "error should be nil")
+        }
+    #else
         XCTAssertNil(error, "error should be nil")
+    #endif
     }
 
     // MARK: Server Trust Policy - Disabling Evaluation Tests