diff --git a/test/nodes/helper.js b/test/nodes/helper.js index ab9ae849d..94f0ca2f8 100644 --- a/test/nodes/helper.js +++ b/test/nodes/helper.js @@ -20,6 +20,7 @@ var request = require('supertest'); var RED = require("../../red/red.js"); var redNodes = require("../../red/nodes"); var flows = require("../../red/nodes/flows"); +var credentials = require("../../red/nodes/credentials"); var comms = require("../../red/comms.js"); var http = require('http'); @@ -38,7 +39,12 @@ function helperNode(n) { } module.exports = { - load: function(testNode, testFlows, cb) { + load: function(testNode, testFlows, testCredentials, cb) { + if (typeof testCredentials === 'function') { + cb = testCredentials; + testCredentials = {}; + } + var storage = { getFlows: function() { var defer = when.defer(); @@ -47,15 +53,19 @@ module.exports = { }, getCredentials: function() { var defer = when.defer(); - defer.resolve({}); + defer.resolve(testCredentials); return defer.promise; }, + saveCredentials: function() { + // do nothing + }, }; var settings = { available: function() { return false; } } redNodes.init(settings, storage); + credentials.init(storage); RED.nodes.registerType("helper", helperNode); testNode(RED); flows.load().then(function() { @@ -73,6 +83,8 @@ module.exports = { return flows.get(id); }, + credentials: credentials, + clearFlows: function() { return flows.clear(); },