'Tests that channel_and_http_session decorator stores the http session key and hydrates it when expected'

def test_channel_and_http_session(self):

    session = session_for_reply_channel(u'test-reply-session')
    message = Message({u'reply_channel': u'test-reply-session', u'http_version': u'1.1', u'method': u'GET', u'path': u'/test2/', u'headers': {u'host': 'example.com', u'cookie': (u'%s=%s' % (settings.SESSION_COOKIE_NAME, session.session_key)).encode(u'ascii')}}, None, None)
    @channel_and_http_session
    def inner(message):
        pass
    inner(message)
    self.assertEqual(message.channel_session[settings.SESSION_COOKIE_NAME], session.session_key)
    message2 = Message({u'reply_channel': u'test-reply-session', u'path': u'/'}, None, None)
    inner(message2)
    self.assertEqual(message2.http_session.session_key, session.session_key)
