UNPKG

1.09 kBJavaScriptView Raw
1/*
2 * device-test.js: Tests for Loggly device requests
3 *
4 * (C) 2010 Nodejitsu Inc.
5 * MIT LICENSE
6 *
7 */
8
9var path = require('path'),
10 vows = require('vows'),
11 assert = require('assert'),
12 helpers = require('./helpers');
13
14var options = {},
15 config = helpers.loadConfig(),
16 loggly = require('../lib/loggly').createClient(config);
17
18vows.describe('node-loggly/devices').addBatch({
19 "When using the node-loggly client": {
20 "the getDevices() method": {
21 topic: function () {
22 loggly.getDevices(this.callback);
23 },
24 "should return a list of valid devices": function (err, devices) {
25 assert.isNull(err);
26 devices.forEach(function (device) {
27 helpers.assertDevice(device);
28 });
29 }
30 },
31 "the addDeviceToInput() method": {
32 topic: function () {
33 loggly.addDeviceToInput(config.inputs.test.id, '127.0.0.1', this.callback);
34 },
35 "should respond with 200 status code": function (err, res) {
36 assert.isNull(err);
37 assert.equal(res.statusCode, 200);
38 }
39 }
40 }
41}).export(module);
\No newline at end of file