mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Update tests for runtime/api separation
This commit is contained in:
@@ -28,13 +28,11 @@ describe("api index", function() {
|
||||
|
||||
describe("disables editor", function() {
|
||||
before(function() {
|
||||
app = express();
|
||||
api.init(app,{
|
||||
settings:{disableEditor:true},
|
||||
api:{
|
||||
|
||||
}
|
||||
api.init({
|
||||
settings:{httpNodeRoot:true, httpAdminRoot: true,disableEditor:true},
|
||||
events: {on:function(){},removeListener: function(){}}
|
||||
});
|
||||
app = api.adminApp();
|
||||
});
|
||||
|
||||
it('does not serve the editor', function(done) {
|
||||
@@ -69,11 +67,11 @@ describe("api index", function() {
|
||||
})
|
||||
});
|
||||
before(function() {
|
||||
app = express();
|
||||
api.init(app,{
|
||||
settings:{adminAuth:{type: "credentials",users:[],default:{permissions:"read"}}},
|
||||
api.init({
|
||||
settings:{httpNodeRoot:true, httpAdminRoot: true, adminAuth:{type: "credentials",users:[],default:{permissions:"read"}}},
|
||||
storage:{getSessions:function(){return when.resolve({})}}
|
||||
});
|
||||
app = api.adminApp();
|
||||
});
|
||||
|
||||
it('it now serves auth', function(done) {
|
||||
@@ -105,12 +103,12 @@ describe("api index", function() {
|
||||
});
|
||||
|
||||
before(function() {
|
||||
app = express();
|
||||
api.init(app,{
|
||||
api.init({
|
||||
log:{audit:function(){}},
|
||||
settings:{disableEditor:false},
|
||||
settings:{httpNodeRoot:true, httpAdminRoot: true,disableEditor:false},
|
||||
events:{on:function(){},removeListener:function(){}}
|
||||
});
|
||||
app = api.adminApp();
|
||||
});
|
||||
it('serves the editor', function(done) {
|
||||
request(app)
|
||||
|
@@ -21,8 +21,6 @@ var bodyParser = require('body-parser');
|
||||
var sinon = require('sinon');
|
||||
var when = require('when');
|
||||
|
||||
var settings = require("../../../red/settings");
|
||||
|
||||
var nodes = require("../../../red/api/nodes");
|
||||
|
||||
describe("nodes api", function() {
|
||||
@@ -335,9 +333,6 @@ describe("nodes api", function() {
|
||||
});
|
||||
describe('delete', function() {
|
||||
it('returns 400 if settings are unavailable', function(done) {
|
||||
var settingsAvailable = sinon.stub(settings,'available', function() {
|
||||
return false;
|
||||
});
|
||||
initNodes({
|
||||
settings:{available:function(){return false}}
|
||||
});
|
||||
@@ -346,7 +341,6 @@ describe("nodes api", function() {
|
||||
.del('/nodes/123')
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
settingsAvailable.restore();
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@ var when = require('when');
|
||||
var fs = require("fs");
|
||||
|
||||
var app = express();
|
||||
var settings = require("../../../red/settings");
|
||||
|
||||
var theme = require("../../../red/api/theme");
|
||||
|
||||
|
Reference in New Issue
Block a user