'On a L{Request}, the C{session} attribute retrieves the associated
L{Session} only if it has been initialized.  If the request is secure,
it retrieves the secure session.'

def test_sessionAttribute(self):

    site = server.Site(resource.Resource())
    d = DummyChannel()
    d.transport = DummyChannel.SSL()
    request = server.Request(d, 1)
    request.site = site
    request.sitepath = []
    self.assertIs(request.session, None)
    insecureSession = request.getSession(forceNotSecure=True)
    self.addCleanup(insecureSession.expire)
    self.assertIs(request.session, None)
    secureSession = request.getSession()
    self.addCleanup(secureSession.expire)
    self.assertIsNot(secureSession, None)
    self.assertIsNot(secureSession, insecureSession)
    self.assertIs(request.session, secureSession)
