Exemplo n.º 1
0
    def test_on_connect_params(self):
        protocol = get_protocol(object)()
        params = {"session_key": ["123cat"]}

        test_request = generate_connection_request("path", params, {})
        protocol.onConnect(test_request)
        self.assertEqual(params, protocol.request_info["get"])
Exemplo n.º 2
0
    def test_on_connect_cookie(self):
        protocol = get_protocol(object)()
        session = "123cat"
        cookie = "somethingelse=test; sessionid={0}".format(session)
        headers = {"cookie": cookie}

        test_request = generate_connection_request("path", {}, headers)
        protocol.onConnect(test_request)
        self.assertEqual(session, protocol.request_info["cookies"]["sessionid"])
Exemplo n.º 3
0
    def test_on_connect_params(self):
        protocol = get_protocol(object)()
        params = {
            "session_key": ["123cat"]
        }

        test_request = generate_connection_request("path", params, {})
        protocol.onConnect(test_request)
        self.assertEqual(params, protocol.request_info["get"])
Exemplo n.º 4
0
    def test_on_connect_cookie(self):
        protocol = get_protocol(object)()
        session = "123cat"
        cookie = "somethingelse=test; sessionid={0}".format(session)
        headers = {
            "cookie": cookie
        }

        test_request = generate_connection_request("path", {}, headers)
        protocol.onConnect(test_request)
        self.assertEqual(session, protocol.request_info["cookies"]["sessionid"])
Exemplo n.º 5
0
 def test_on_connect_path(self):
     protocol = get_protocol(object)()
     path = "path"
     test_request = generate_connection_request(path, {}, {})
     protocol.onConnect(test_request)
     self.assertEqual(path, protocol.request_info["path"])
Exemplo n.º 6
0
 def test_on_connect_no_cookie(self):
     protocol = get_protocol(object)()
     test_request = generate_connection_request("path", {}, {})
     protocol.onConnect(test_request)
     self.assertEqual({}, protocol.request_info["cookies"])
Exemplo n.º 7
0
 def test_on_connect_path(self):
     protocol = get_protocol(object)()
     path = "path"
     test_request = generate_connection_request(path, {}, {})
     protocol.onConnect(test_request)
     self.assertEqual(path, protocol.request_info["path"])
Exemplo n.º 8
0
 def test_on_connect_no_cookie(self):
     protocol = get_protocol(object)()
     test_request = generate_connection_request("path", {}, {})
     protocol.onConnect(test_request)
     self.assertEqual({}, protocol.request_info["cookies"])