Tinytest.add("session hooks - identifying a human", function() {

});

Tinytest.add("session - update stats", function() {

});

Tinytest.add("session - update stats and blocked", function() {

});
@@ -1,28 +1,74 @@
+var sessionProto = MeteorX.Session.prototype;%0A
 Tinytest.add(%22session hooks 
@@ -92,36 +92,437 @@
 uman%22, function(
-) %7B%0A
+test) %7B%0A  var context = %7B%0A    send: sinon.stub(),%0A    socket: %7B%0A      headers: %7B%7D,%0A      remoteAddress: Random.id()%0A    %7D%0A  %7D;%0A  var humanToken = Random.id();%0A  var msg = %7B%0A    msg: %22method%22,%0A    method: %22setFirewallHumanToken%22,%0A    params: %5BhumanToken%5D%0A  %7D;%0A%0A  sessionProto.processMessage.call(context, msg);%0A  test.equal(context._firewallHumanToken, humanToken);%0A  test.equal(context.send.callCount, 2);
 %0A%7D);%0A%0ATinytest.a
@@ -525,32 +525,38 @@
 st.add(%22session 
+hooks 
 - update stats%22,
@@ -561,28 +561,667 @@
 %22, function(
-) %7B%0A
+test) %7B%0A  var ip = Random.id();%0A  var sessionId = Random.id();%0A  var humanToken = Random.id();%0A%0A  var context = %7B%0A    send: sinon.stub(),%0A    socket: %7B%0A      headers: %7B%7D,%0A      remoteAddress: ip%0A    %7D,%0A    id: sessionId,%0A    _firewallHumanToken: humanToken%0A  %7D;%0A%0A  var msg = %7B%0A    msg: %22method%22,%0A    method: %22not-existing%22,%0A    params: %5B10%5D%0A  %7D;%0A%0A  var newFirewall = %7B%0A    _updateStats: sinon.stub()%0A  %7D;%0A%0A  WithNew(Firewall, newFirewall, function() %7B%0A    sessionProto.processMessage.call(context, msg);%0A    test.equal(newFirewall._updateStats.callCount, 1);%0A    test.equal(newFirewall._updateStats.args%5B0%5D, %5Bip, sessionId, humanToken%5D);%0A  %7D);
 %0A%7D);%0A%0ATinyte
@@ -1236,16 +1236,22 @@
 session 
+hooks 
 - update
@@ -1280,16 +1280,553 @@
 unction(
-) %7B%0A
+test) %7B%0A  var context = %7B%0A    send: sinon.stub(),%0A    socket: %7B%0A      headers: %7B%7D,%0A      removeAllListeners: sinon.stub()%0A    %7D%0A  %7D;%0A%0A  var msg = %7B%0A    msg: %22method%22,%0A    method: %22not-existing%22,%0A    params: %5B10%5D%0A  %7D;%0A%0A  var newFirewall = %7B%0A    _updateStats: sinon.stub()%0A  %7D;%0A%0A  WithNew(Firewall, newFirewall, function() %7B%0A    newFirewall._updateStats.onCall(0).returns(true);%0A    sessionProto.processMessage.call(context, msg);%0A    test.equal(context.send.callCount, 1);%0A    test.equal(context.socket.removeAllListeners.callCount, 1);%0A  %7D);
 %0A%7D);

Add tests for session hooks