2019-08-27 11:52:53 +08:00
|
|
|
|
using System;
|
|
|
|
|
using LeanCloud;
|
2019-12-05 16:06:54 +08:00
|
|
|
|
using LeanCloud.Common;
|
2019-08-27 11:52:53 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
2019-09-17 11:53:28 +08:00
|
|
|
|
namespace LeanCloud.Test {
|
2019-08-27 11:52:53 +08:00
|
|
|
|
public static class Utils {
|
2019-08-27 15:19:19 +08:00
|
|
|
|
public static void InitNorthChina(bool master = false) {
|
|
|
|
|
if (master) {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "https://avoscloud.com", "qKH9ryRagHKvXeRRVkiUiHeb");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
} else {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "https://avoscloud.com");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
}
|
2019-08-27 11:52:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-27 15:19:19 +08:00
|
|
|
|
public static void InitEastChina(bool master = false) {
|
|
|
|
|
if (master) {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("4eTwHdYhMaNBUpl1SrTr7GLC-9Nh9j0Va", "GSD6DtdgGWlWolivN4qhWtlE", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com", "eqEp4n89h4zanWFskDDpIwL4");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
} else {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("4eTwHdYhMaNBUpl1SrTr7GLC-9Nh9j0Va", "GSD6DtdgGWlWolivN4qhWtlE", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 15:07:19 +08:00
|
|
|
|
public static void InitOldEastChina(bool master = false) {
|
|
|
|
|
if (master) {
|
|
|
|
|
Init("SpT4SjWdvM9TSvCTKk6rqYQ9-9Nh9j0Va", "4NvN2OfdsWFC7qzzNcNS6paS", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com", "eqEp4n89h4zanWFskDDpIwL4");
|
|
|
|
|
} else {
|
|
|
|
|
Init("SpT4SjWdvM9TSvCTKk6rqYQ9-9Nh9j0Va", "4NvN2OfdsWFC7qzzNcNS6paS", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-27 15:19:19 +08:00
|
|
|
|
public static void InitUS(bool master = false) {
|
|
|
|
|
if (master) {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("MFAS1GnOyomRLSQYRaxdgdPz-MdYXbMMI", "p42JUxdxb95K5G8187t5ba3l", "https://MFAS1GnO.api.lncldglobal.com", "https://MFAS1GnO.engine.lncldglobal.com", "Ahb1wdFLwMgKwEaEicHRXbCY");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
} else {
|
2019-08-28 18:19:26 +08:00
|
|
|
|
Init("MFAS1GnOyomRLSQYRaxdgdPz-MdYXbMMI", "p42JUxdxb95K5G8187t5ba3l", "https://MFAS1GnO.api.lncldglobal.com", "https://MFAS1GnO.engine.lncldglobal.com");
|
2019-08-27 15:19:19 +08:00
|
|
|
|
}
|
2019-08-27 11:52:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-28 18:19:26 +08:00
|
|
|
|
static void Init(string appId, string appKey, string apiServer, string engineServer, string masterKey = null) {
|
2019-08-27 11:52:53 +08:00
|
|
|
|
AVClient.Initialize(new AVClient.Configuration {
|
2019-08-27 15:19:19 +08:00
|
|
|
|
ApplicationId = appId,
|
|
|
|
|
ApplicationKey = appKey,
|
|
|
|
|
MasterKey = masterKey,
|
2019-08-28 18:19:26 +08:00
|
|
|
|
ApiServer = apiServer,
|
2019-09-06 14:08:05 +08:00
|
|
|
|
EngineServer = engineServer
|
2019-08-27 11:52:53 +08:00
|
|
|
|
});
|
2019-08-27 15:19:19 +08:00
|
|
|
|
AVClient.UseMasterKey = !string.IsNullOrEmpty(masterKey);
|
2019-08-27 11:52:53 +08:00
|
|
|
|
AVClient.HttpLog(TestContext.Out.WriteLine);
|
|
|
|
|
}
|
2019-12-05 16:06:54 +08:00
|
|
|
|
|
|
|
|
|
internal static void Print(LogLevel level, string info) {
|
|
|
|
|
switch (level) {
|
|
|
|
|
case LogLevel.Debug:
|
|
|
|
|
TestContext.Out.WriteLine($"[DEBUG] {info}");
|
|
|
|
|
break;
|
|
|
|
|
case LogLevel.Warn:
|
|
|
|
|
TestContext.Out.WriteLine($"[WARNING] {info}");
|
|
|
|
|
break;
|
|
|
|
|
case LogLevel.Error:
|
|
|
|
|
TestContext.Out.WriteLine($"[ERROR] {info}");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
TestContext.Out.WriteLine(info);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-27 11:52:53 +08:00
|
|
|
|
}
|
|
|
|
|
}
|