def test_terminate_error(self): sc = ServerConnection((self.d.IFACE, self.d.port)) sc.connect() sc.connection = mock.Mock() sc.connection.recv = mock.Mock(return_value=False) sc.connection.flush = mock.Mock(side_effect=TcpDisconnect) sc.finish()
def test_terminate_error(self): sc = ServerConnection((self.d.IFACE, self.d.port)) 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()
def test_terminate_error(self): self.d = test.Daemon() sc = ServerConnection((self.d.IFACE, self.d.port)) sc.connect() sc.connection = mock.Mock() sc.connection.recv = mock.Mock(return_value=False) sc.connection.flush = mock.Mock(side_effect=TcpDisconnect) sc.finish() self.d.shutdown()
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 sc.wfile.write(http1.assemble_request(f.request)) sc.wfile.flush() assert http1.read_response(sc.rfile, f.request, 1000) assert self.d.last_log() sc.finish()
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()
def test_simple(self): self.d = test.Daemon() 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 sc.wfile.write(http1.assemble_request(f.request)) sc.wfile.flush() assert http1.read_response(sc.rfile, f.request, 1000) assert self.d.last_log() sc.finish() self.d.shutdown()