summaryrefslogtreecommitdiff
path: root/demoscript/Ice/session.py
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-15 13:59:55 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-08-15 13:59:55 -0230
commit1d265d0027c43825a0dd9567589758713a27452c (patch)
tree207e11aba123ed504311ba5b988b79d151852704 /demoscript/Ice/session.py
parentAdded missing file (diff)
downloadice-1d265d0027c43825a0dd9567589758713a27452c.tar.bz2
ice-1d265d0027c43825a0dd9567589758713a27452c.tar.xz
ice-1d265d0027c43825a0dd9567589758713a27452c.zip
Added expect scripts
Diffstat (limited to 'demoscript/Ice/session.py')
-rwxr-xr-xdemoscript/Ice/session.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/demoscript/Ice/session.py b/demoscript/Ice/session.py
new file mode 100755
index 00000000000..1a5691552c2
--- /dev/null
+++ b/demoscript/Ice/session.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import pexpect, sys, demoscript
+
+def run(clientStr, server):
+ client = demoscript.Util.spawn(clientStr)
+ client.expect('==>')
+ client.sendline('foo')
+
+ print "testing session creation...",
+ sys.stdout.flush()
+ server.expect('The session foo is now created.')
+ client.sendline('c')
+ client.sendline('0')
+ server.expect("Hello object #0 for session `foo' says:\r{1,2}\nHello foo!")
+ client.sendline('1')
+ client.expect('Index is too high')
+ client.sendline('x')
+ client.expect(pexpect.EOF)
+ assert client.wait() == 0
+ server.expect("The session foo is now destroyed.")
+ print "ok"
+
+ print "testing session cleanup...",
+ sys.stdout.flush()
+ client = demoscript.Util.spawn(clientStr)
+ client.expect('==>')
+ client.sendline('foo')
+ server.expect('The session foo is now created.')
+ client.sendline('c')
+ client.sendline('t')
+ client.expect(pexpect.EOF)
+ assert client.wait() == 0
+ server.expect("The session foo is now destroyed.\r{1,2}\n.*The session foo has timed out.", timeout=25)
+ print "ok"
+
+ client = demoscript.Util.spawn(clientStr)
+ client.expect('==>')
+ client.sendline('foo')
+ server.expect('The session foo is now created.')
+ client.sendline('s')
+ server.expect(pexpect.EOF)
+ assert server.wait() == 0
+
+ client.sendline('x')
+ client.expect(pexpect.EOF)
+ assert client.wait() == 0