'L{Request.getSession} generates a new session if the relevant cookie is
set in the incoming request.'

def test_retrieveNonExistentSession(self):

    site = server.Site(resource.Resource())
    d = DummyChannel()
    request = server.Request(d, 1)
    request.site = site
    request.sitepath = []
    request.received_cookies['TWISTED_SESSION'] = 'does-not-exist'
    session = request.getSession()
    self.assertIsNotNone(session)
    self.addCleanup(session.expire)
    self.assertTrue(request.cookies[0].startswith('TWISTED_SESSION='))
    self.assertNotIn('does-not-exist', request.cookies[0])
