summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cullen <david.cullen@technicolor.com>2016-06-29 10:32:54 -0400
committerDavid Cullen <david.cullen@technicolor.com>2016-06-29 10:32:54 -0400
commitdd93bad924a011d73b03d69bdc76cb1b93a30520 (patch)
tree22d58472c92c55be693f2c97ba6438d43faa553b
parent507a427e235afb1255308ca72051b7e7e9067142 (diff)
downloadpexpect-dd93bad924a011d73b03d69bdc76cb1b93a30520.tar.gz
Added test_socket_with_write.
-rw-r--r--tests/test_socket.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_socket.py b/tests/test_socket.py
index 4f100ed..56d69c7 100644
--- a/tests/test_socket.py
+++ b/tests/test_socket.py
@@ -153,6 +153,20 @@ class ExpectTestCase(PexpectTestCase.PexpectTestCase):
session.expect(pexpect.EOF)
self.assertEqual(session.before, b'')
+ def test_socket_with_write(self):
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.connect((self.host, self.port))
+ session = fdpexpect.fdspawn(sock.fileno(), timeout=10)
+ session.expect(self.prompt1)
+ self.assertEqual(session.before, self.motd)
+ session.write(self.enter)
+ session.expect(self.prompt2)
+ session.write(self.enter)
+ session.expect(self.prompt3)
+ session.write(self.exit)
+ session.expect(pexpect.EOF)
+ self.assertEqual(session.before, b'')
+
def test_not_int(self):
with self.assertRaises(pexpect.ExceptionPexpect):
session = fdpexpect.fdspawn('bogus', timeout=10)