예제 #1
0
    def test_wr_output_echo(self):
        instr = b'\x00 \t\nabc123\x80\xff'

        wr(instr)
        res = self.server.recv(len(instr))
        output = strip_ansi(self.stdout.read())

        self.assertEqual(instr, res)
        self.assertEqual(output, '\\x00 \\x09\nabc123\\x80\\xff')
예제 #2
0
    def test_wr_output_echo(self):
        instr = b'\x00 \t\nabc123\x80\xff'

        wr(instr)
        res = self.server.recv(len(instr))
        output = strip_ansi(self.stdout.read())

        self.assertEqual(instr, res)
        self.assertEqual(output, '\\x00 \\x09\nabc123\\x80\\xff')
예제 #3
0
    def test_wr_output_echo_noescape(self):
        self.sock.escape = False

        instr = b'\x00 \t\nabc123\x80\xff'
        wr(instr)
        res = self.server.recv(len(instr))
        output = strip_ansi(self.stdout.read())

        self.assertEqual(res, instr)
        self.assertEqual(output, _bytes_to_text(instr))
예제 #4
0
    def test_wr_output_echo_noescape(self):
        self.sock.escape = False

        instr = b'\x00 \t\nabc123\x80\xff'
        wr(instr)
        res = self.server.recv(len(instr))
        output = strip_ansi(self.stdout.read())

        self.assertEqual(res, instr)
        self.assertEqual(output, _bytes_to_text(instr))
예제 #5
0
    def test_wr_types(self):
        wr(b'1234')
        self.assertServerRecv(b'1234')

        wr(bytearray(b'1234'))
        self.assertServerRecv(b'1234')

        wr(1234)
        self.assertServerRecv(b'1234')

        wr("1234")
        self.assertServerRecv(b'1234')

        wr((1, ))
        self.assertServerRecv(b'(1,)')
예제 #6
0
    def test_wr_types(self):
        wr(b'1234')
        self.assertServerRecv(b'1234')

        wr(bytearray(b'1234'))
        self.assertServerRecv(b'1234')

        wr(1234)
        self.assertServerRecv(b'1234')

        wr("1234")
        self.assertServerRecv(b'1234')

        wr((1,))
        self.assertServerRecv(b'(1,)')
예제 #7
0
    def test_wr_output_noecho(self):
        self.sock.echo = False

        instr = b'\x00 \t\nabc123\x80\xff'
        wr(instr)
        res = self.server.recv(len(instr))

        # ensure stdout isn't empty (since self.stdout is nonblocking)
        sys.stdout.write('x')
        sys.stdout.flush()

        output = self.stdout.read()

        self.assertEqual(res, instr)
        # check that there was no output besides the character we stuffed in
        self.assertEqual(output, 'x')
예제 #8
0
    def test_wr_output_noecho(self):
        self.sock.echo = False

        instr = b'\x00 \t\nabc123\x80\xff'
        wr(instr)
        res = self.server.recv(len(instr))

        # ensure stdout isn't empty (since self.stdout is nonblocking)
        sys.stdout.write('x')
        sys.stdout.flush()

        output = self.stdout.read()

        self.assertEqual(res, instr)
        # check that there was no output besides the character we stuffed in
        self.assertEqual(output, 'x')