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:
parent
1840d15397
commit
d78916f85f
@ -21,6 +21,8 @@ var express = require("express");
|
|||||||
var editorApi = require("../../../../red/api/editor");
|
var editorApi = require("../../../../red/api/editor");
|
||||||
var comms = require("../../../../red/api/editor/comms");
|
var comms = require("../../../../red/api/editor/comms");
|
||||||
var info = require("../../../../red/api/editor/settings");
|
var info = require("../../../../red/api/editor/settings");
|
||||||
|
var auth = require("../../../../red/api/auth");
|
||||||
|
var when = require("when");
|
||||||
|
|
||||||
|
|
||||||
describe("api/editor/index", function() {
|
describe("api/editor/index", function() {
|
||||||
@ -49,6 +51,7 @@ describe("api/editor/index", function() {
|
|||||||
]
|
]
|
||||||
var isStarted = true;
|
var isStarted = true;
|
||||||
var errors = [];
|
var errors = [];
|
||||||
|
var session_data = {};
|
||||||
before(function() {
|
before(function() {
|
||||||
mockList.forEach(function(m) {
|
mockList.forEach(function(m) {
|
||||||
sinon.stub(require("../../../../red/api/editor/"+m),"init",function(){});
|
sinon.stub(require("../../../../red/api/editor/"+m),"init",function(){});
|
||||||
@ -63,6 +66,25 @@ describe("api/editor/index", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
before(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({},{
|
app = editorApi.init({},{
|
||||||
log:{audit:function(){},error:function(msg){errors.push(msg)}},
|
log:{audit:function(){},error:function(msg){errors.push(msg)}},
|
||||||
settings:{httpNodeRoot:true, httpAdminRoot: true,disableEditor:false,exportNodeSettings:function(){}},
|
settings:{httpNodeRoot:true, httpAdminRoot: true,disableEditor:false,exportNodeSettings:function(){}},
|
||||||
|
Loading…
Reference in New Issue
Block a user