mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Delete unnecessary comments & add trace mock function
This commit is contained in:
parent
d35784ec61
commit
c09a407f4c
@ -37,29 +37,13 @@ describe("api/editor/sshkeys", function() {
|
|||||||
var isStarted = true;
|
var isStarted = true;
|
||||||
var errors = [];
|
var errors = [];
|
||||||
var session_data = {};
|
var session_data = {};
|
||||||
// before(function() {
|
|
||||||
// mockList.forEach(function(m) {
|
|
||||||
// sinon.stub(require("../../../../../red/api/editor/"+m),"init",function(){});
|
|
||||||
// });
|
|
||||||
// sinon.stub(require("../../../../../red/api/editor/theme"),"app",function(){ return express()});
|
|
||||||
// });
|
|
||||||
// after(function() {
|
|
||||||
// mockList.forEach(function(m) {
|
|
||||||
// require("../../../../../red/api/editor/"+m).init.restore();
|
|
||||||
// })
|
|
||||||
// require("../../../../../red/api/editor/theme").app.restore();
|
|
||||||
// });
|
|
||||||
var mockRuntime = {
|
var mockRuntime = {
|
||||||
settings:{
|
settings:{
|
||||||
httpNodeRoot: true,
|
httpNodeRoot: true,
|
||||||
httpAdminRoot: true,
|
httpAdminRoot: true,
|
||||||
disableEditor: false,
|
disableEditor: false,
|
||||||
exportNodeSettings:function(){},
|
exportNodeSettings:function(){},
|
||||||
// adminAuth: {
|
|
||||||
// default: {
|
|
||||||
// permissions: ['*']
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
storage: {
|
storage: {
|
||||||
getSessions: function(){
|
getSessions: function(){
|
||||||
return when.resolve(session_data);
|
return when.resolve(session_data);
|
||||||
@ -92,7 +76,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
app.use(editorApi.init({},mockRuntime));
|
app.use(editorApi.init({},mockRuntime));
|
||||||
});
|
});
|
||||||
after(function() {
|
after(function() {
|
||||||
// fs.removeSync()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -170,7 +153,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
|
|
||||||
it('GET /settings/user/keys --- return Unexpected Error', function(done) {
|
it('GET /settings/user/keys --- return Unexpected Error', function(done) {
|
||||||
var errInstance = new Error("Messages.....");
|
var errInstance = new Error("Messages.....");
|
||||||
// errInstance.code = "test_code";
|
|
||||||
mockRuntime.storage.sshkeys.listSSHKeys.returns(Promise.reject(errInstance));
|
mockRuntime.storage.sshkeys.listSSHKeys.returns(Promise.reject(errInstance));
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys")
|
.get("/settings/user/keys")
|
||||||
@ -227,7 +209,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
it('GET /settings/user/keys/<key_file_name> --- return Unexpected Error', function(done) {
|
it('GET /settings/user/keys/<key_file_name> --- return Unexpected Error', function(done) {
|
||||||
var key_file_name = "test_key";
|
var key_file_name = "test_key";
|
||||||
var errInstance = new Error("Messages.....");
|
var errInstance = new Error("Messages.....");
|
||||||
// errInstance.code = "test_code";
|
|
||||||
mockRuntime.storage.sshkeys.getSSHKey.returns(Promise.reject(errInstance));
|
mockRuntime.storage.sshkeys.getSSHKey.returns(Promise.reject(errInstance));
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys/" + key_file_name)
|
.get("/settings/user/keys/" + key_file_name)
|
||||||
@ -264,7 +245,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.storage.sshkeys.generateSSHKey.returns(Promise.resolve(key_file_name));
|
mockRuntime.storage.sshkeys.generateSSHKey.returns(Promise.resolve(key_file_name));
|
||||||
request(app)
|
request(app)
|
||||||
.post("/settings/user/keys")
|
.post("/settings/user/keys")
|
||||||
// .send({ name: key_file_name })
|
|
||||||
.expect(400)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -302,7 +282,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
it('POST /settings/user/keys --- return Unexpected error', function(done) {
|
it('POST /settings/user/keys --- return Unexpected error', function(done) {
|
||||||
var key_file_name = "test_key";
|
var key_file_name = "test_key";
|
||||||
var errInstance = new Error("Messages.....");
|
var errInstance = new Error("Messages.....");
|
||||||
// errInstance.code = "test_code";
|
|
||||||
mockRuntime.storage.sshkeys.generateSSHKey.returns(Promise.reject(errInstance));
|
mockRuntime.storage.sshkeys.generateSSHKey.returns(Promise.reject(errInstance));
|
||||||
request(app)
|
request(app)
|
||||||
.post("/settings/user/keys")
|
.post("/settings/user/keys")
|
||||||
@ -358,7 +337,6 @@ describe("api/editor/sshkeys", function() {
|
|||||||
it('DELETE /settings/user/keys/<key_file_name> --- return Unexpected Error', function(done) {
|
it('DELETE /settings/user/keys/<key_file_name> --- return Unexpected Error', function(done) {
|
||||||
var key_file_name = "test_key";
|
var key_file_name = "test_key";
|
||||||
var errInstance = new Error("Messages.....");
|
var errInstance = new Error("Messages.....");
|
||||||
// errInstance.code = "test_code";
|
|
||||||
mockRuntime.storage.sshkeys.deleteSSHKey.returns(Promise.reject(errInstance));
|
mockRuntime.storage.sshkeys.deleteSSHKey.returns(Promise.reject(errInstance));
|
||||||
request(app)
|
request(app)
|
||||||
.delete("/settings/user/keys/" + key_file_name)
|
.delete("/settings/user/keys/" + key_file_name)
|
||||||
|
@ -28,7 +28,8 @@ describe("storage/localfilesystem/sshkeys", function() {
|
|||||||
var mockRuntime = {
|
var mockRuntime = {
|
||||||
log:{
|
log:{
|
||||||
_:function() { return "placeholder message"},
|
_:function() { return "placeholder message"},
|
||||||
info: function() { }
|
info: function() { },
|
||||||
|
trace: function() { }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
|
Loading…
Reference in New Issue
Block a user