rest-sessions
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.11.1 | ||
@@ -128,2 +128,6 @@ /* | ||
app.get('/ping', function(req, res) { | ||
rs.ping(_.partial(_respond, res)); | ||
}); | ||
module.exports = app; |
{ | ||
"name": "rest-sessions", | ||
"description": "A REST interface for redis-sessions", | ||
"version": "1.0.10", | ||
"author": "P. Liess <smrchy+npm@gmail.com>", | ||
"engines": { | ||
"node": "> 0.10.20" | ||
}, | ||
"scripts": { | ||
"test": "mocha ./test/test.js" | ||
}, | ||
"bin": { | ||
"rest-sessions": "./bin/rest-sessions.js" | ||
}, | ||
"dependencies": { | ||
"redis-sessions": "^1.0.4", | ||
"express": "4.13.4", | ||
"lodash": "^4.x", | ||
"morgan": "^1.6.1", | ||
"body-parser": "^1.14.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*", | ||
"async": "*" | ||
}, | ||
"keywords": [ | ||
"rest", | ||
"http", | ||
"cookies", | ||
"sessions", | ||
"redis", | ||
"session", | ||
"users", | ||
"activity", | ||
"php", | ||
"coldfusion", | ||
"asp", | ||
".net", | ||
"python", | ||
"ruby" | ||
], | ||
"repository" : { | ||
"type": "git", | ||
"url": "http://github.com/smrchy/rest-sessions.git" | ||
} | ||
"name": "rest-sessions", | ||
"description": "A REST interface for redis-sessions", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
"author": "P. Liess <smrchy+npm@gmail.com>", | ||
"engines": { | ||
"node": "> 0.10.20" | ||
}, | ||
"scripts": { | ||
"test": "mocha ./test/test.js" | ||
}, | ||
"bin": { | ||
"rest-sessions": "./bin/rest-sessions.js" | ||
}, | ||
"dependencies": { | ||
"redis-sessions": "^1.1", | ||
"express": "4.13.4", | ||
"lodash": "^4.x", | ||
"morgan": "^1.6.1", | ||
"body-parser": "^1.14.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*", | ||
"async": "*" | ||
}, | ||
"keywords": [ | ||
"rest", | ||
"http", | ||
"cookies", | ||
"sessions", | ||
"redis", | ||
"session", | ||
"users", | ||
"activity", | ||
"php", | ||
"coldfusion", | ||
"asp", | ||
".net", | ||
"python", | ||
"ruby" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/smrchy/rest-sessions.git" | ||
} | ||
} |
@@ -307,2 +307,10 @@ # REST-Sessions | ||
### GET /ping | ||
Pings the redis server and returns | ||
``` | ||
PONG | ||
``` | ||
## License | ||
@@ -312,3 +320,3 @@ | ||
Copyright (c) 2010 TCS <dev (at) tcs.de> | ||
Copyright (c) 2010-2016 TCS <dev (at) tcs.de> | ||
@@ -315,0 +323,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
318
test/test.js
@@ -1,179 +0,185 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var app, async, http, should, _; | ||
// Generated by CoffeeScript 1.11.1 | ||
var _, app, async, http, should; | ||
_ = require("lodash"); | ||
_ = require("lodash"); | ||
should = require("should"); | ||
should = require("should"); | ||
async = require("async"); | ||
async = require("async"); | ||
app = require("../app"); | ||
app = require("../app"); | ||
http = require("../test/support/http"); | ||
http = require("../test/support/http"); | ||
describe('REST-Sessions Test', function() { | ||
var token1, token2, user1, user2; | ||
before(function(done) { | ||
http.createServer(app, done); | ||
describe('REST-Sessions Test', function() { | ||
var token1, token2, user1, user2; | ||
before(function(done) { | ||
http.createServer(app, done); | ||
}); | ||
after(function(done) { | ||
done(); | ||
}); | ||
token1 = null; | ||
token2 = null; | ||
user1 = null; | ||
user2 = null; | ||
it('GET /ping should return 200 and "PONG"', function(done) { | ||
http.request().get('/ping').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = resp.body; | ||
body.should.equal('PONG'); | ||
done(); | ||
}); | ||
after(function(done) { | ||
}); | ||
it('PUT /TestApp/create/user1 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user1?ip=127.0.0.1').set('Content-Type', 'application/json').write(JSON.stringify({ | ||
blarg: "foo" | ||
})).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token1 = body.token; | ||
token1.length.should.equal(64); | ||
done(); | ||
}); | ||
token1 = null; | ||
token2 = null; | ||
user1 = null; | ||
user2 = null; | ||
it('PUT /TestApp/create/user1 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user1?ip=127.0.0.1').set('Content-Type', 'application/json').write(JSON.stringify({ | ||
blarg: "foo" | ||
})).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token1 = body.token; | ||
token1.length.should.equal(64); | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/get/{token} should return 200 and user1', function(done) { | ||
http.request().get('/TestApp/get/' + token1).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.d.blarg.should.equal('foo'); | ||
body.id.should.equal('user1'); | ||
user1 = body; | ||
done(); | ||
}); | ||
it('GET /TestApp/get/{token} should return 200 and user1', function(done) { | ||
http.request().get('/TestApp/get/' + token1).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.d.blarg.should.equal('foo'); | ||
body.id.should.equal('user1'); | ||
user1 = body; | ||
done(); | ||
}); | ||
}); | ||
it('PUT /TestApp/create/user2 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.1').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token2 = body.token; | ||
token2.length.should.equal(64); | ||
done(); | ||
}); | ||
it('PUT /TestApp/create/user2 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.1').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token2 = body.token; | ||
token2.length.should.equal(64); | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/get/{token} should return 200 and user2', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.id.should.equal('user2'); | ||
user2 = body; | ||
done(); | ||
}); | ||
it('GET /TestApp/get/{token} should return 200 and user2', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.id.should.equal('user2'); | ||
user2 = body; | ||
done(); | ||
}); | ||
}); | ||
it('POST /TestApp/set/{token} set some data', function(done) { | ||
http.request().post('/TestApp/set/' + token1).set('Content-Type', 'application/json').write(JSON.stringify({ | ||
somebool: true, | ||
account: 120.55, | ||
name: "Peter Smith" | ||
})).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.id.should.equal('user1'); | ||
body.d.somebool.should.equal(true); | ||
body.d.account.should.equal(120.55); | ||
body.d.name.should.equal("Peter Smith"); | ||
return done(); | ||
}); | ||
it('POST /TestApp/set/{token} set some data', function(done) { | ||
http.request().post('/TestApp/set/' + token1).set('Content-Type', 'application/json').write(JSON.stringify({ | ||
somebool: true, | ||
account: 120.55, | ||
name: "Peter Smith" | ||
})).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.id.should.equal('user1'); | ||
body.d.somebool.should.equal(true); | ||
body.d.account.should.equal(120.55); | ||
body.d.name.should.equal("Peter Smith"); | ||
return done(); | ||
}); | ||
return; | ||
return; | ||
}); | ||
it('DELETE /TestApp/kill should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/kill/' + token2).expect(200, done); | ||
}); | ||
it('GET /TestApp/activity should return 200 and 1 session', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(1); | ||
done(); | ||
}); | ||
it('DELETE /TestApp/kill should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/kill/' + token2).expect(200, done); | ||
}); | ||
it('GET /TestApp/get/{token} should not return a session', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.should.not.have.keys('id'); | ||
user2 = body; | ||
done(); | ||
}); | ||
it('GET /TestApp/activity should return 200 and 1 session', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(1); | ||
done(); | ||
}); | ||
}); | ||
it('PUT /TestApp/create/user2 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.1').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token2 = body.token; | ||
token2.length.should.equal(64); | ||
done(); | ||
}); | ||
it('GET /TestApp/get/{token} should not return a session', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.should.not.have.keys('id'); | ||
user2 = body; | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/get/{token} should return a session', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.should.have.keys('id'); | ||
user2 = body; | ||
done(); | ||
}); | ||
it('PUT /TestApp/create/user2 should return 200 and a token', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.1').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
token2 = body.token; | ||
token2.length.should.equal(64); | ||
done(); | ||
}); | ||
}); | ||
it('PUT /TestApp/create/user2 create another session for user2', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.2').end(function(resp) { | ||
resp.statusCode.should.equal(200); | ||
done(); | ||
}); | ||
it('GET /TestApp/get/{token} should return a session', function(done) { | ||
http.request().get('/TestApp/get/' + token2).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.should.not.have.keys('id'); | ||
user2 = body; | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/activity should return 200 and equal 2 even if we got 3 sessions', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(2); | ||
done(); | ||
}); | ||
it('PUT /TestApp/create/user2 create another session for user2', function(done) { | ||
http.request().put('/TestApp/create/user2?ip=127.0.0.2').end(function(resp) { | ||
resp.statusCode.should.equal(200); | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/soapp should return 200 and 3 sessions', function(done) { | ||
http.request().get('/TestApp/soapp?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.sessions.length.should.equal(3); | ||
done(); | ||
}); | ||
it('GET /TestApp/activity should return 200 and equal 2 even if we got 3 sessions', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(2); | ||
done(); | ||
}); | ||
}); | ||
it('GET /TestApp/soid/user2 should return 200 and 2 sessions', function(done) { | ||
http.request().get('/TestApp/soid/' + user2.id).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.sessions.length.should.equal(2); | ||
done(); | ||
}); | ||
it('GET /TestApp/soapp should return 200 and 3 sessions', function(done) { | ||
http.request().get('/TestApp/soapp?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.sessions.length.should.equal(3); | ||
done(); | ||
}); | ||
}); | ||
it('DELETE /TestApp/killsoid/user2 should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/killsoid/' + user2.id).expect(200, done); | ||
}); | ||
it('GET /TestApp/activity should return 200 and equal 1', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(1); | ||
done(); | ||
}); | ||
it('GET /TestApp/soid/user2 should return 200 and 2 sessions', function(done) { | ||
http.request().get('/TestApp/soid/' + user2.id).end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.sessions.length.should.equal(2); | ||
done(); | ||
}); | ||
}); | ||
it('DELETE /TestApp/killsoid/user2 should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/killsoid/' + user2.id).expect(200, done); | ||
}); | ||
it('GET /TestApp/activity should return 200 and equal 1', function(done) { | ||
http.request().get('/TestApp/activity?dt=600').end(function(resp) { | ||
var body; | ||
resp.statusCode.should.equal(200); | ||
body = JSON.parse(resp.body); | ||
body.activity.should.equal(1); | ||
done(); | ||
}); | ||
}); | ||
it('DELETE /TestApp/killall should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/killall').expect(200, done); | ||
}); | ||
}); | ||
}).call(this); | ||
it('DELETE /TestApp/killall should return 200 ', function(done) { | ||
http.request()["delete"]('/TestApp/killall').expect(200, done); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
28174
383
339
1
14
Updatedredis-sessions@^1.1