Пример #1
0
    def test_updateSession(self):
        session = self.site.makeSession()

        class FakeChannel(object):
            transport = None

            def isSecure(self):
                return False

            def getPeer(self):
                return None

            def getHost(self):
                return None

        request = Request(FakeChannel(), False)
        request.sitepath = [b"bb"]
        session.updateSession(request)
        self.assertEqual(len(request.cookies), 1)
        name, value = request.cookies[0].split(b";")[0].split(b"=")
        decoded = jwt.decode(value,
                             self.SECRET,
                             algorithms=[service.SESSION_SECRET_ALGORITHM])
        self.assertEqual(decoded['user_info'], {'anonymous': True})
        self.assertIn('exp', decoded)
Пример #2
0
 def test_updateSession(self):
     session = self.site.makeSession()
     request = Request(FakeChannel(), False)
     request.sitepath = [b"bb"]
     session.updateSession(request)
     self.assertEqual(len(request.cookies), 1)
     _, value = request.cookies[0].split(b";")[0].split(b"=")
     decoded = jwt.decode(value,
                          self.SECRET,
                          algorithms=[service.SESSION_SECRET_ALGORITHM])
     self.assertEqual(decoded['user_info'], {'anonymous': True})
     self.assertIn('exp', decoded)
Пример #3
0
    def test_updateSession(self):
        session = self.site.makeSession()

        class FakeChannel(object):
            transport = None

            def isSecure(self):
                return False
        request = Request(FakeChannel(), False)
        request.sitepath = ["bb"]
        session.updateSession(request)
        self.assertEqual(len(request.cookies), 1)
        name, value = request.cookies[0].split(";")[0].split("=")
        decoded = jwt.decode(value, self.SECRET, algorithm=service.SESSION_SECRET_ALGORITHM)
        self.assertEqual(decoded['user_info'], {'anonymous': True})
        self.assertIn('exp', decoded)