Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Tests/AsyncHTTPClientTests/HTTPClientNIOTSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ class HTTPClientNIOTSTests: XCTestCase {
func testTrustRootCertificateLoadFail() {
guard isTestingNIOTS() else { return }
#if canImport(Network)
let tlsConfig = TLSConfiguration.forClient(trustRoots: .file("not/a/certificate"))
XCTAssertThrowsError(try tlsConfig.getNWProtocolTLSOptions()) { error in
switch error {
case let error as NIOSSL.NIOSSLError where error == .failedToLoadCertificate:
break
default:
XCTFail("\(error)")
if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
let tlsConfig = TLSConfiguration.forClient(trustRoots: .file("not/a/certificate"))

XCTAssertThrowsError(try tlsConfig.getNWProtocolTLSOptions()) { error in
switch error {
case let error as NIOSSL.NIOSSLError where error == .failedToLoadCertificate:
break
default:
XCTFail("\(error)")
}
}
} else {
XCTFail("should be impossible")
}
#endif
}
Expand Down