Installing a module returns module info

Removing a module checks module exists and checks type is not in use
This commit is contained in:
Anna Thomas
2014-11-21 15:15:24 +00:00
parent 4c9d53388c
commit dd5821ee1b
4 changed files with 145 additions and 64 deletions

View File

@@ -203,13 +203,21 @@ describe("nodes api", function() {
});
describe('by module', function() {
it('installs the module and returns node info', function(done) {
it('installs the module and returns module info', function(done) {
var settingsAvailable = sinon.stub(settings,'available', function() {
return true;
});
var getNodeModuleInfo = sinon.stub(redNodes,'getNodeModuleInfo',function(id) {
return null;
});
var getModuleInfo = sinon.stub(redNodes,'getModuleInfo',function(module) {
if (module === "foo") {
return {
name:"foo",
nodes:[{id:123}]
};
}
});
var installModule = sinon.stub(server,'installModule', function() {
return when.resolve({id:"123"});
});
@@ -221,11 +229,14 @@ describe("nodes api", function() {
.end(function(err,res) {
settingsAvailable.restore();
getNodeModuleInfo.restore();
getModuleInfo.restore();
installModule.restore();
if (err) {
throw err;
}
res.body.should.have.property("id","123");
res.body.should.have.property("name","foo");
res.body.should.have.property("nodes");
res.body.nodes[0].should.have.property("id","123");
done();
});
});