changeset 844:4e84893a1725

Test case for apps/share-open.py.
author Martin Geisler <mg@daimi.au.dk>
date Mon, 21 Jul 2008 23:46:32 +0200
parents e0ba3202ebd2
children 8bf14cf5dd0a
files viff/test/test_apps.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/test/test_apps.py	Mon Jul 21 23:36:31 2008 +0200
+++ b/viff/test/test_apps.py	Mon Jul 21 23:46:32 2008 +0200
@@ -26,6 +26,8 @@
 from twisted.internet.utils import getProcessOutput
 from twisted.internet.defer import Deferred, gatherResults
 
+from viff.field import GF256
+
 def execute(executable, *args):
     """Execute *executable* when the reactor is started."""
     d = Deferred()
@@ -80,3 +82,20 @@
         result = gatherResults([m1, m2, m3])
         result.addCallback(check_outputs)
         return result
+
+    def test_share_open(self):
+        """Test apps/share-open.py."""
+        
+        def check_outputs(outputs):
+            for o in outputs:
+                self.assertIn("opened a: %s" % GF256(17), o)
+                self.assertIn("opened b: %s" % GF256(40), o)
+                self.assertIn("opened c: %s" % GF256(235), o)
+
+        p1 = execute('share-open.py', 'player-1.ini', '17')
+        p2 = execute('share-open.py', 'player-2.ini', '40')
+        p3 = execute('share-open.py', 'player-3.ini', '235')
+        
+        result = gatherResults([p1, p2, p3])
+        result.addCallback(check_outputs)
+        return result