Skip to content

Commit

Permalink
Removing fixes for other bug
Browse files Browse the repository at this point in the history
  • Loading branch information
martinthomson committed Apr 26, 2012
1 parent 67b4eb9 commit 8d269aa
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions test/manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,86 +220,6 @@ module.exports = {
});
},

'test authorization gets handshake data': function (done) {
var port = ++ports
, io = sio.listen(port)
, cl = client(port);

io.configure(function () {
function auth (data, fn) {
data.query.should.have.foo;
data.query.foo.should.eql('bar');
fn(null, false);
};

io.set('authorization', auth);
});

cl.get('/socket.io/{protocol}/?foo=bar', function (res, data) {
res.statusCode.should.eql(403);
data.should.match(/handshake unauthorized/);

cl.end();
io.server.close();
done();
});
},

'test that authorization can view handshake data': function (done) {
var port = ++ports
, io = sio.listen(port)
, cl = client(port);

io.configure(function () {
function auth (data, fn) {
data.query.should.have.foo;
data.query.foo.should.eql('bar');
fn(null, true);
};

io.set('authorization', auth);
});

cl.get('/socket.io/{protocol}/?foo=bar', function (res, data) {
res.statusCode.should.eql(200);

cl.end();
io.server.close();
done();
});
},

'test that authorization can change handshake data': function (done) {
var port = ++ports
, io = sio.listen(port)
, cl = client(port);

io.configure(function () {
function auth (data, fn) {
var replacement = { baz: 'qu' };
for (i in data) {
if (data.hasOwnProperty(i)) {
replacement[i] = data[i];
}
}
fn(null, true, replacement);
};

io.set('authorization', auth);
});

cl.get('/socket.io/{protocol}/', function (res, data) {
var id = data.split(':', 2)[0];
res.statusCode.should.eql(200);
io.handshaken[id].should.have.baz;
io.handshaken[id].baz.should.eql('qu');

cl.end();
io.server.close();
done();
});
},

'test a handshake error': function (done) {
var port = ++ports
, io = sio.listen(port)
Expand Down

0 comments on commit 8d269aa

Please sign in to comment.