9a5774f184cc828f6faa3e0049324b92ee15272f.svn-base
1.07 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
/*
* device-test.js: Tests for Loggly device requests
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
var path = require('path'),
vows = require('vows'),
assert = require('assert'),
helpers = require('./helpers');
var options = {},
config = helpers.loadConfig(),
loggly = require('../lib/loggly').createClient(config);
vows.describe('node-loggly/devices').addBatch({
"When using the node-loggly client": {
"the getDevices() method": {
topic: function () {
loggly.getDevices(this.callback);
},
"should return a list of valid devices": function (err, devices) {
assert.isNull(err);
devices.forEach(function (device) {
helpers.assertDevice(device);
});
}
},
"the addDeviceToInput() method": {
topic: function () {
loggly.addDeviceToInput(config.inputs.test.id, '127.0.0.1', this.callback);
},
"should respond with 200 status code": function (err, res) {
assert.isNull(err);
assert.equal(res.statusCode, 200);
}
}
}
}).export(module);