-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtestDnsZone.js
More file actions
98 lines (78 loc) · 2.55 KB
/
testDnsZone.js
File metadata and controls
98 lines (78 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var pkgcloud = require('pkgcloud'),
logging = require('../../../common/logging'),
config = require('../../../common/config'),
_ = require('underscore');
var path = require('path'),
fs = require('fs'),
async = require('async'),
chai = require('chai');
//var log = logging.getLogger(process.env.PKGCLOUD_LOG_LEVEL || 'debug');
var expect = chai.expect,
should = chai.should();
describe('DNS Zone Integration Tests', function () {
var client, zoneName, adminEmail, apiUser, tempZone;
before(function (done) {
client = pkgcloud.providers.rackspace.dns.createClient(config.getConfig('rackspace', process.env['PKGCLOUD_TESTS_DEFAULT_USERNAME']));
zoneName = 'that.test.computer';
adminEmail = 'test@test.com';
done();
});
after(function (done) {
client.deleteZone(tempZone, {name: zoneName, email: adminEmail}, function (err) {
if (!err) {
console.log('DNS Zone teardown successful');
}
done();
});
});
describe('createZone tests', function () {
it('createZone is successful', function (done) {
client.createZone({name: zoneName, email: adminEmail}, function (err, zone) {
should.not.exist(err);
zone.should.be.an('object');
tempZone = zone;
done();
});
});
it('createZone should fail with same params', function (done) {
client.createZone({name: zoneName, email: adminEmail}, function (err, zone) {
should.not.exist(zone);
err.should.be.an('object');
done();
});
});
});
describe('updateZone tests', function () {
it('updateZone should successfully modify Zone', function (done) {
tempZone.emailAddress = 'changed@test.com';
client.updateZone(tempZone, function (err) {
if(err) throw err;
done();
});
});
it('updateZone should fail', function (done) {
tempZone.emailAddress = '0';
client.updateZone(tempZone, function (err) {
should.exist(err);
err.should.be.an('object');
done();
});
});
});
describe('getZone tests', function () {
it('getZone should retrieve correct zone', function (done) {
client.getZone(tempZone.id, function (err, zone) {
zone.id.should.equal(tempZone.id);
should.not.exist(err);
done();
});
});
it('getZone should fail not found', function (done) {
client.getZone('AW-01010', function (err, zone) {
err.should.be.an('object');
should.not.exist(zone);
done();
});
});
});
});