Added test to cover #25
This commit is contained in:
parent
65c4160c8e
commit
e75fbeb2e3
2 changed files with 16 additions and 1 deletions
|
|
@ -57,6 +57,11 @@ var chat = io.of('/chat').on('connection', function (socket) {
|
|||
socket.on('aaa', function() {
|
||||
socket.emit('aaa_response', 'in chat');
|
||||
});
|
||||
socket.on('ack', function(payload) {
|
||||
socket.emit('ack_response', payload, function(payload) {
|
||||
socket.emit('ack_callback_response', payload);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var news = io.of('/news').on('connection', function (socket) {
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class BaseMixin(object):
|
|||
'ack_callback_response': (PAYLOAD,),
|
||||
})
|
||||
|
||||
def test_namespaces(self):
|
||||
def test_namespace_emit(self):
|
||||
'Behave differently in different namespaces'
|
||||
main_namespace = self.socketIO.define(Namespace)
|
||||
chat_namespace = self.socketIO.define(Namespace, '/chat')
|
||||
|
|
@ -151,6 +151,16 @@ class BaseMixin(object):
|
|||
'emit_with_payload_response': (PAYLOAD,),
|
||||
})
|
||||
|
||||
def test_namespace_ack(self):
|
||||
'Trigger server callback'
|
||||
chat_namespace = self.socketIO.define(Namespace, '/chat')
|
||||
chat_namespace.emit('ack', PAYLOAD)
|
||||
self.socketIO.wait(self.wait_time_in_seconds)
|
||||
self.assertEqual(chat_namespace.args_by_event, {
|
||||
'ack_response': (PAYLOAD,),
|
||||
'ack_callback_response': (PAYLOAD,),
|
||||
})
|
||||
|
||||
|
||||
class Test_WebsocketTransport(TestCase, BaseMixin):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue