Files
certd/packages/certd/test/dns-provider/aliyun.test.js
T

44 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-12-13 23:06:17 +08:00
import pkg from 'chai'
import options from '../options.js'
import AliyunDnsProvider from '../../src/dns-provider/impl/aliyun.js'
2020-12-24 00:49:31 +08:00
import { Certd } from '../../src/index.js'
2020-12-13 23:06:17 +08:00
const { expect } = pkg
describe('AliyunDnsProvider', function () {
it('#getDomainList', async function () {
2020-12-19 01:57:52 +08:00
const aliyunDnsProvider = new AliyunDnsProvider(options.accessProviders.aliyun)
2020-12-13 23:06:17 +08:00
const domainList = await aliyunDnsProvider.getDomainList()
console.log('domainList', domainList)
expect(domainList.length).gt(0)
})
it('#getRecords', async function () {
2020-12-19 01:57:52 +08:00
const aliyunDnsProvider = new AliyunDnsProvider(options.accessProviders.aliyun)
2020-12-13 23:06:17 +08:00
const recordList = await aliyunDnsProvider.getRecords('docmirror.cn', '*')
console.log('recordList', recordList)
expect(recordList.length).gt(0)
})
2020-12-24 00:49:31 +08:00
it('#createAndRemoveRecord', async function () {
2020-12-19 01:57:52 +08:00
const aliyunDnsProvider = new AliyunDnsProvider(options.accessProviders.aliyun)
2020-12-24 00:49:31 +08:00
const record = await aliyunDnsProvider.createRecord({ fullRecord: '___certd___.__test__.docmirror.cn', type: 'TXT', value: 'aaaa' })
console.log('recordId', record)
expect(record != null).ok
const recordId = await aliyunDnsProvider.removeRecord({ fullRecord: '___certd___.__test__.docmirror.cn', type: 'TXT', value: 'aaaa', record })
2020-12-13 23:06:17 +08:00
console.log('recordId', recordId)
expect(recordId != null).ok
})
2020-12-24 00:49:31 +08:00
it('#申请证书-aliyun', async function () {
this.timeout(300000)
options.args = { forceCert: true }
const certd = new Certd()
const cert = await certd.certApply(options)
expect(cert).ok
expect(cert.crt).ok
expect(cert.key).ok
expect(cert.detail).ok
expect(cert.expires).ok
2020-12-13 23:06:17 +08:00
})
})