diff --git a/OpenVPN Adapter Tests/ProfileLoader.swift b/OpenVPN Adapter Tests/ProfileLoader.swift new file mode 100644 index 0000000..52a989a --- /dev/null +++ b/OpenVPN Adapter Tests/ProfileLoader.swift @@ -0,0 +1,31 @@ +// +// ProfileLoader.swift +// OpenVPN Adapter +// +// Created by Sergey Abramchuk on 22.04.17. +// +// + +import Foundation + +enum ProfileType: String { + case localKeyAuthentication = "local_key_auth" +} + +struct ProfileLoader { + + static func getVPNProfile(type: ProfileType) -> Data { + let fileName = type.rawValue + + guard + let path = Bundle.current.url(forResource: fileName, withExtension: "ovpn"), + let profile = try? Data(contentsOf: path) + else { + fatalError("Failed to retrieve OpenVPN profile") + } + + return profile + } + +} + diff --git a/OpenVPN Adapter Tests/Resources/local_vpn_server.ovpn b/OpenVPN Adapter Tests/Resources/local_key_auth.ovpn similarity index 100% rename from OpenVPN Adapter Tests/Resources/local_vpn_server.ovpn rename to OpenVPN Adapter Tests/Resources/local_key_auth.ovpn