|
|
|
@ -17,31 +17,42 @@ test('Custom config load test', async (t) => {
@@ -17,31 +17,42 @@ test('Custom config load test', async (t) => {
|
|
|
|
|
console.log('Config data', defaultConfig); |
|
|
|
|
assert.equal(defaultConfig.ALIBABA_CLOUD_ACCESS_KEY_ID, '你的AccessKey ID'); |
|
|
|
|
|
|
|
|
|
let myConfig = await getCustomConfigs('./conf/custom_config.json'); |
|
|
|
|
let myConfig = await getCustomConfigs('../conf/custom_config.json'); |
|
|
|
|
console.log('Custom config data', myConfig); |
|
|
|
|
assert.ok(myConfig); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('AliyunSmsClient test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('./conf/custom_config.json'); |
|
|
|
|
/* |
|
|
|
|
test('AliyunSmsClient send sms test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('../conf/custom_config.json'); |
|
|
|
|
let client = aliyunSmsClient.createClient(myConfig); |
|
|
|
|
|
|
|
|
|
assert.ok(client); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
let signName = 'Ta荐', |
|
|
|
|
templateCode = 'SMS_465915662', |
|
|
|
|
templateParam = '{"code":"2345"}', |
|
|
|
|
phoneNumber = '13168946847'; |
|
|
|
|
|
|
|
|
|
let sended = await aliyunSmsClient.send(myConfig, signName, templateCode, templateParam, phoneNumber); |
|
|
|
|
|
|
|
|
|
assert.equal(sended, true); |
|
|
|
|
*/ |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Aliyun api test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('./conf/custom_config.json'); |
|
|
|
|
test('AliyunSmsClient send query test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('../conf/custom_config.json'); |
|
|
|
|
let client = aliyunSmsClient.createClient(myConfig); |
|
|
|
|
|
|
|
|
|
assert.ok(client); |
|
|
|
|
|
|
|
|
|
let phoneNumber = '13168946847'; |
|
|
|
|
let sendRes = await aliyunSmsClient.queryLastOneDetail(myConfig, phoneNumber); |
|
|
|
|
assert.equal(sendRes, 2); |
|
|
|
|
}); |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
test('Aliyun api sms send test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('../conf/custom_config.json'); |
|
|
|
|
|
|
|
|
|
let api = 'http://127.0.0.1:8081/aliyun/sendverifycode'; |
|
|
|
|
let params = { |
|
|
|
@ -61,3 +72,25 @@ test('Aliyun api test', async (t) => {
@@ -61,3 +72,25 @@ test('Aliyun api test', async (t) => {
|
|
|
|
|
assert.equal(response.status, 200); |
|
|
|
|
assert.equal(response.data.code, 1); |
|
|
|
|
}); |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
test('Aliyun api sms query test', async (t) => { |
|
|
|
|
let myConfig = await getCustomConfigs('../conf/custom_config.json'); |
|
|
|
|
|
|
|
|
|
let api = 'http://127.0.0.1:8081/aliyun/querysendresult'; |
|
|
|
|
let params = { |
|
|
|
|
phoneNumber: '13168946847', |
|
|
|
|
action: 'register' |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let sign = common.sign(params, myConfig.secret); |
|
|
|
|
assert.ok(myConfig); |
|
|
|
|
assert.ok(sign); |
|
|
|
|
|
|
|
|
|
params.sign = sign; |
|
|
|
|
const response = await axios.post(api, params, axiosConfig); |
|
|
|
|
console.log(response.data); |
|
|
|
|
|
|
|
|
|
assert.equal(response.status, 200); |
|
|
|
|
assert.equal(response.data.code, 1); |
|
|
|
|
}); |