@@ -11,15 +11,13 @@ import XCTest
1111
1212class BaseTestCase : XCTestCase {
1313
14- let timeout : TimeInterval = 60.0
15-
1614 static let timeout : TimeInterval = 60.0
15+ let timeout : TimeInterval = 60.0
1716
18- var uuid : String {
17+ static var uuid : String {
1918 return UUID ( ) . uuidString. replacingOccurrences ( of: " - " , with: " " )
2019 }
21-
22- static var uuid : String {
20+ var uuid : String {
2321 return UUID ( ) . uuidString. replacingOccurrences ( of: " - " , with: " " )
2422 }
2523
@@ -32,28 +30,34 @@ class BaseTestCase: XCTestCase {
3230 static let cnApp = AppInfo (
3331 id: " S5vDI3IeCk1NLLiM1aFg3262-gzGzoHsz " ,
3432 key: " 7g5pPsI55piz2PRLPWK5MPz0 " ,
35- serverURL: " https://s5vdi3ie.lc-cn-n1-shared.com "
36- )
33+ serverURL: " https://s5vdi3ie.lc-cn-n1-shared.com " )
34+
35+ static let ceApp = AppInfo (
36+ id: " skhiVsqIk7NLVdtHaUiWn0No-9Nh9j0Va " ,
37+ key: " T3TEAIcL8Ls5XGPsGz41B1bz " ,
38+ serverURL: " https://skhivsqi.lc-cn-e1-shared.com " )
39+
40+ static let usApp = AppInfo (
41+ id: " jenSt9nvWtuJtmurdE28eg5M-MdYXbMMI " ,
42+ key: " 8VLPsDlskJi8KsKppED4xKS0 " ,
43+ serverURL: " " )
44+
45+ static var config : LCApplication . Configuration {
46+ var config = LCApplication . Configuration ( )
47+ config. RTMCustomServerURL = RTMBaseTestCase . testableRTMURL
48+ return config
49+ }
3750
3851 override class func setUp( ) {
3952 super. setUp ( )
40-
53+ let app = BaseTestCase . cnApp
4154 TestObject . register ( )
42-
4355 LCApplication . logLevel = . all
44-
4556 try ! LCApplication . default. set (
46- id: BaseTestCase . cnApp. id,
47- key: BaseTestCase . cnApp. key,
48- serverURL: BaseTestCase . cnApp. serverURL)
49-
50- // var config = LCApplication.Configuration()
51- // config.RTMCustomServerURL = RTMBaseTestCase.testableRTMURL
52- // try! LCApplication.default.set(
53- // id: BaseTestCase.cnApp.id,
54- // key: BaseTestCase.cnApp.key,
55- // serverURL: BaseTestCase.cnApp.serverURL,
56- // configuration: config)
57+ id: app. id,
58+ key: app. key,
59+ serverURL: app. serverURL. isEmpty ? nil : app. serverURL,
60+ configuration: BaseTestCase . config)
5761 }
5862
5963 override class func tearDown( ) {
@@ -161,24 +165,29 @@ extension BaseTestCase {
161165extension LCApplication {
162166
163167 var masterKey : String {
168+ let key : String
164169 switch self . id {
165- case " S5vDI3IeCk1NLLiM1aFg3262-gzGzoHsz " :
166- return " Q26gTodbyi1Ki7lM9vtncF6U,master "
170+ case BaseTestCase . cnApp. id:
171+ key = " Q26gTodbyi1Ki7lM9vtncF6U "
172+ case BaseTestCase . ceApp. id:
173+ key = " FTPdEcG7vLKxNqKxYhTFdK4g "
174+ case BaseTestCase . usApp. id:
175+ key = " fasiJXz8jvSwn3G2B2QeraRe "
167176 default :
168177 fatalError ( )
169178 }
179+ return key + " ,master "
170180 }
171181
172182 var v2router : AppRouter {
173183 return AppRouter (
174184 application: self ,
175- configuration: AppRouter . Configuration ( apiVersion: " 1.2 " )
176- )
185+ configuration: AppRouter . Configuration ( apiVersion: " 1.2 " ) )
177186 }
178187
179188 var applicationSupportDirectoryURL : URL {
180- return (
181- try ! FileManager . default. url (
189+ return ( try !
190+ FileManager . default. url (
182191 for: . applicationSupportDirectory,
183192 in: . userDomainMask,
184193 appropriateFor: nil ,
@@ -192,8 +201,8 @@ extension LCApplication {
192201 }
193202
194203 var cachesDirectoryURL : URL {
195- return (
196- try ! FileManager . default. url (
204+ return ( try !
205+ FileManager . default. url (
197206 for: . cachesDirectory,
198207 in: . userDomainMask,
199208 appropriateFor: nil ,
0 commit comments