-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUtil.swift
50 lines (40 loc) · 1.17 KB
/
Util.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
@package Twilio Message
@author Ryan Powell
@license MIT
*/
import Foundation
import XCTest
class Util {
}
extension Bundle {
static var testBundle: Bundle {
return Bundle(for: Util.self)
}
}
extension Bundle {
var accountSID: String {
let val = _getTestKey(Bundle.kAccountSID)
print("Retrieved value: \(val) for accountSID")
return val
}
var authToken: String {
let val = _getTestKey(Bundle.kAuthToken)
print("Retrieved value: \(val) for authToken")
return val
}
var toSMSNumber: String {
let val = _getTestKey(Bundle.kToSMSNumber)
print("Retrieved value: \(val) for toSMSNumber")
return val
}
fileprivate func _getTestKey(_ testKey: String) -> String {
let envValue = ProcessInfo.processInfo.environment[testKey]
let bundleValue = self.infoDictionary?[testKey] as? String
let returnValue = envValue ?? ( bundleValue ?? "" )
return returnValue
}
fileprivate static let kAccountSID = "accountSID"
fileprivate static let kAuthToken = "authToken"
fileprivate static let kToSMSNumber = "toSMSNumber"
}