Beispiel #1
0
 def test_terminate_error(self):
     sc = ServerConnection((self.d.IFACE, self.d.port), None)
     sc.connect()
     sc.connection = mock.Mock()
     sc.connection.recv = mock.Mock(return_value=False)
     sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect)
     sc.finish()
Beispiel #2
0
 def test_terminate_error(self):
     sc = ServerConnection((self.d.IFACE, self.d.port), None)
     sc.connect()
     sc.connection = mock.Mock()
     sc.connection.recv = mock.Mock(return_value=False)
     sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect)
     sc.finish()
Beispiel #3
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port), None)
        sc.connect()
        r = tutils.treq()
        r.flow.server_conn = sc
        r.path = "/p/200:da"
        sc.send(r._assemble())
        assert http.read_response(sc.rfile, r.method, 1000)
        assert self.d.last_log()

        sc.finish()
Beispiel #4
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port), None)
        sc.connect()
        r = tutils.treq()
        r.flow.server_conn = sc
        r.path = "/p/200:da"
        sc.send(r._assemble())
        assert http.read_response(sc.rfile, r.method, 1000)
        assert self.d.last_log()

        sc.finish()
Beispiel #5
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port))
        sc.connect()
        f = tutils.tflow()
        f.server_conn = sc
        f.request.path = "/p/200:da"
        sc.send(f.request.assemble())
        assert http.read_response(sc.rfile, f.request.method, 1000)
        assert self.d.last_log()

        sc.finish()
Beispiel #6
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port))
        sc.connect()
        f = tutils.tflow()
        f.server_conn = sc
        f.request.path = "/p/200:da"
        sc.send(f.request.assemble())
        assert http.read_response(sc.rfile, f.request.method, 1000)
        assert self.d.last_log()

        sc.finish()
Beispiel #7
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port))
        sc.connect()
        f = tutils.tflow()
        f.server_conn = sc
        f.request.path = "/p/200:da"

        # use this protocol just to assemble - not for actual sending
        protocol = http.http1.HTTP1Protocol(rfile=sc.rfile)
        sc.send(protocol.assemble(f.request))

        protocol = http.http1.HTTP1Protocol(rfile=sc.rfile)
        assert protocol.read_response(f.request.method, 1000)
        assert self.d.last_log()

        sc.finish()
Beispiel #8
0
    def test_simple(self):
        sc = ServerConnection((self.d.IFACE, self.d.port))
        sc.connect()
        f = tutils.tflow()
        f.server_conn = sc
        f.request.path = "/p/200:da"

        # use this protocol just to assemble - not for actual sending
        protocol = http.http1.HTTP1Protocol(rfile=sc.rfile)
        sc.send(protocol.assemble(f.request))

        protocol = http.http1.HTTP1Protocol(rfile=sc.rfile)
        assert protocol.read_response(f.request.method, 1000)
        assert self.d.last_log()

        sc.finish()