mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Check if credentials are required for connection test
This commit is contained in:
@@ -75,13 +75,27 @@ class OpenVPNAdapterTests: XCTestCase {
|
|||||||
|
|
||||||
let configuration = OpenVPNConfiguration()
|
let configuration = OpenVPNConfiguration()
|
||||||
configuration.fileContent = vpnConfiguration
|
configuration.fileContent = vpnConfiguration
|
||||||
|
|
||||||
|
let result: OpenVPNProperties
|
||||||
do {
|
do {
|
||||||
_ = try adapter.apply(configuration: configuration)
|
result = try adapter.apply(configuration: configuration)
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("Failed to configure OpenVPN adapted due to error: \(error)")
|
XCTFail("Failed to configure OpenVPN adapted due to error: \(error)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !result.autologin {
|
||||||
|
let credentials = OpenVPNCredentials()
|
||||||
|
credentials.username = VPNProfile.username
|
||||||
|
credentials.password = VPNProfile.password
|
||||||
|
|
||||||
|
do {
|
||||||
|
try adapter.provide(credentials: credentials)
|
||||||
|
} catch {
|
||||||
|
XCTFail("Failed to provide credentials. \(error)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expectations[.connection] = expectation(description: "me.ss-abramchuk.openvpn-adapter.connection")
|
expectations[.connection] = expectation(description: "me.ss-abramchuk.openvpn-adapter.connection")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user