Ejemplo n.º 1
0
    def test_getSession_no_session(self):
        """
        None is returned if the request does not contain session
        information or the information is not valid.
        """
        session = json_rpc._get_session(self.request)

        self.assertIsNone(session)

        request = manufacture.makeTwistedWebRequest()
        request.setRequestHeader(
            'authorization', manufacture.getUniqueString())

        session = json_rpc._get_session(request)

        self.assertIsNone(session)
Ejemplo n.º 2
0
    def test_getSession_valid_session(self):
        """
        The session instance is returned if the request header contains
        valid session information.
        """
        self.request.setRequestHeader('authorization', self.session.uid)

        value = json_rpc._get_session(self.request)

        self.assertIsNotNone(value)
        self.assertEquals(self.session.uid, value.uid)