docker-mock
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -5,2 +5,3 @@ var _ = require('lodash'); | ||
var series = require('middleware-flow').series; | ||
var bodyParser = require('body-parser'); | ||
@@ -14,2 +15,3 @@ var containers = {}; | ||
app.post('/containers/create', | ||
bodyParser.json(), | ||
mw.createContainer(containers), | ||
@@ -16,0 +18,0 @@ mw.respondContainer(201)); |
@@ -130,2 +130,3 @@ var _ = require('lodash'); | ||
}; | ||
data = _.extend(data, req.body); | ||
var returnData = { | ||
@@ -132,0 +133,0 @@ 'Id': Id, |
{ | ||
"name": "docker-mock", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Mock for Docker", | ||
@@ -41,2 +41,3 @@ "main": "lib/index.js", | ||
"blanket": "^1.1.6", | ||
"body-parser": "^1.9.0", | ||
"dockerode": "~2.0.0", | ||
@@ -43,0 +44,0 @@ "mocha": "^1.18.2", |
@@ -20,2 +20,19 @@ var dockerMock = require('../lib/index'); | ||
}); | ||
it('should create a container with env in the body', function (done) { | ||
var createData = { | ||
Env: [ 'MY_AWESOME_ENV_VARIABLE=inconceivable' ] | ||
}; | ||
async.waterfall([ | ||
docker.createContainer.bind(docker, createData), | ||
function (container, cb) { | ||
container.inspect(cb); | ||
} | ||
], function (err, containerData) { | ||
if (err) return done(err); | ||
Array.isArray(containerData.Env).should.equal(true); | ||
containerData.Env.length.should.equal(1); | ||
containerData.Env[0].should.equal(createData.Env[0]); | ||
docker.getContainer(containerData.Id).remove(done); | ||
}); | ||
}); | ||
it('should list all the containers when there are none', function (done) { | ||
@@ -141,14 +158,16 @@ docker.listContainers(function (err, containers) { | ||
}); | ||
it('should noop if stopped twice', function (done) { | ||
it('should come back with an error if stopped twice', function (done) { | ||
async.series([ | ||
container.start.bind(container), | ||
container.stop.bind(container), | ||
container.stop.bind(container) | ||
], function (err) { | ||
if (err) return done(err); | ||
container.inspect(function (err, data) { | ||
if (err) return done(err); | ||
data.State.Running.should.equal(false); | ||
data.State.Pid.should.equal(-1); | ||
done(); | ||
container.stop(function (err, data) { | ||
err.statusCode.should.equal(304); | ||
container.inspect(function (err, data) { | ||
if (err) return done(err); | ||
data.State.Running.should.equal(false); | ||
data.State.Pid.should.equal(-1); | ||
done(); | ||
}); | ||
}); | ||
@@ -383,3 +402,3 @@ }); | ||
data.Images.should.equal(0); | ||
data.Mock.should.be.true; | ||
data.Mock.should.equal(true); | ||
cb(); | ||
@@ -386,0 +405,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 6 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
845
60300
9
15
6