1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix the error occuring during permission check (#1510)

This commit is contained in:
Hideki Nakamura 2017-12-06 22:18:36 +09:00 committed by Nick O'Leary
parent 1840d15397
commit d78916f85f

View File

@ -21,6 +21,8 @@ var express = require("express");
var editorApi = require("../../../../red/api/editor");
var comms = require("../../../../red/api/editor/comms");
var info = require("../../../../red/api/editor/settings");
var auth = require("../../../../red/api/auth");
var when = require("when");
describe("api/editor/index", function() {
@ -49,6 +51,7 @@ describe("api/editor/index", function() {
]
var isStarted = true;
var errors = [];
var session_data = {};
before(function() {
mockList.forEach(function(m) {
sinon.stub(require("../../../../red/api/editor/"+m),"init",function(){});
@ -63,6 +66,25 @@ describe("api/editor/index", function() {
});
before(function() {
auth.init({
settings:{
adminAuth: {
default: {
permissions: ['read']
}
},
storage: {
getSessions: function(){
return when.resolve(session_data);
},
setSessions: function(_session) {
session_data = _session;
return when.resolve();
}
},
log:{audit:function(){},error:function(msg){errors.push(msg)}}
}
});
app = editorApi.init({},{
log:{audit:function(){},error:function(msg){errors.push(msg)}},
settings:{httpNodeRoot:true, httpAdminRoot: true,disableEditor:false,exportNodeSettings:function(){}},