'Tests that strict mode of enforce_ordering puts messages in the correct queue after
the current message number changes while the message is being processed'

def test_enforce_ordering_concurrent(self):

    message0 = Message({u'reply_channel': u'test-reply-e', u'order': 0}, u'websocket.connect', channel_layers[DEFAULT_CHANNEL_LAYER])
    message2 = Message({u'reply_channel': u'test-reply-e', u'order': 2}, u'websocket.receive', channel_layers[DEFAULT_CHANNEL_LAYER])
    message3 = Message({u'reply_channel': u'test-reply-e', u'order': 3}, u'websocket.receive', channel_layers[DEFAULT_CHANNEL_LAYER])
    @channel_session
    def add_session(message):
        pass
    @enforce_ordering
    def inner(message):
        pass
    inner(message0)
    inner(message3)
    add_session(message2)
    with mock.patch.object(message2.channel_session, u'load', return_value={u'__channels_next_order': 2}):
        inner(message2)
    wait_channel = (u'__wait__.%s' % u'test-reply-e')
    next_message = self.get_next_message(wait_channel)
    self.assertEqual(next_message, None)
    expected = {2: message2, 3: message3}
    for m in range(2):
        message = self.get_next_message(u'websocket.receive')
        expected.pop(message.content[u'order'])
    self.assertEqual(expected, {})
