mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Add OpenVPNCertificate files and their tests to the project
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// OpenVPNCertificateTests.swift
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 06.09.17.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import OpenVPNAdapter
|
||||
|
||||
class OpenVPNCertificateTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testCertificateFromPEM() {
|
||||
guard
|
||||
let caURL = Bundle.current.url(forResource: "ca", withExtension: "crt"),
|
||||
let caData = try? Data(contentsOf: caURL)
|
||||
// let caContent = try? String(contentsOf: caURL, encoding: .utf8).cString(using: .utf8)
|
||||
else {
|
||||
XCTFail("")
|
||||
return
|
||||
}
|
||||
|
||||
let certificate: OpenVPNCertificate
|
||||
do {
|
||||
certificate = try OpenVPNCertificate(pem: caData)
|
||||
} catch {
|
||||
XCTFail(error.localizedDescription)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user