2016-05-15 17:51:48 +00:00
|
|
|
"use strict";
|
2016-05-24 21:36:06 +00:00
|
|
|
require("typings-test");
|
2016-05-15 17:51:48 +00:00
|
|
|
var cflare = require("../dist/index");
|
2016-05-16 01:29:29 +00:00
|
|
|
var should = require("should");
|
2016-06-20 20:56:09 +00:00
|
|
|
var qenv_1 = require("qenv");
|
|
|
|
var testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + "/.nogit");
|
2016-05-15 17:51:48 +00:00
|
|
|
var testCflareAccount = new cflare.CflareAccount();
|
|
|
|
testCflareAccount.auth({
|
2016-06-20 20:56:09 +00:00
|
|
|
email: process.env.CF_EMAIL,
|
|
|
|
key: process.env.CF_KEY
|
2016-05-15 17:51:48 +00:00
|
|
|
});
|
2016-05-16 01:29:29 +00:00
|
|
|
describe("cflare", function () {
|
|
|
|
describe(".CflareAccount", function () {
|
|
|
|
describe(".listZones()", function () {
|
|
|
|
it("should display an account", function (done) {
|
|
|
|
this.timeout(10000);
|
|
|
|
testCflareAccount.listZones()
|
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe(".getZoneId(domainName)", function () {
|
|
|
|
it("should get an Cloudflare Id for a domain string", function (done) {
|
2016-05-24 21:36:06 +00:00
|
|
|
this.timeout(10000);
|
2016-06-20 20:56:09 +00:00
|
|
|
testCflareAccount.getZoneId("bleu.de")
|
2016-05-16 01:29:29 +00:00
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe(".listRecords(domainName)", function () {
|
|
|
|
it("should list all records for a specific Domain Name", function (done) {
|
2016-05-24 21:36:06 +00:00
|
|
|
this.timeout(10000);
|
2016-06-20 20:56:09 +00:00
|
|
|
testCflareAccount.listRecords("bleu.de")
|
2016-05-16 01:29:29 +00:00
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-05-24 21:36:06 +00:00
|
|
|
describe(".createRecord", function () {
|
|
|
|
this.timeout(10000);
|
2016-05-25 04:26:48 +00:00
|
|
|
it("should create a valid record for a level 2 domain", function (done) {
|
2016-05-24 21:36:06 +00:00
|
|
|
testCflareAccount.createRecord("bleu.de", "A", "127.0.0.1")
|
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-05-25 04:26:48 +00:00
|
|
|
it("should create a valid record for a subdomain", function (done) {
|
|
|
|
testCflareAccount.createRecord("subdomain.bleu.de", "A", "127.0.0.1")
|
|
|
|
.then(function (responseArg) {
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe(".removeRecord", function () {
|
|
|
|
/*it("should remove a record from Cloudflare",function(done){
|
|
|
|
testCflareAccount.removeRecord()
|
|
|
|
.then(function(responseArg){
|
|
|
|
console.log(responseArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});*/
|
2016-05-24 21:36:06 +00:00
|
|
|
});
|
2016-05-16 01:29:29 +00:00
|
|
|
});
|
|
|
|
});
|
2016-05-15 17:51:48 +00:00
|
|
|
|
2016-06-20 20:56:09 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBTyxNQUFNLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDekMsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLHFCQUFtQixNQUFNLENBQUMsQ0FBQTtBQUMxQixJQUFJLFFBQVEs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