aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/test_gnunet_peerinfo.py.in
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2010-04-30 05:35:52 +0000
committerDavid Barksdale <amatus.amongus@gmail.com>2010-04-30 05:35:52 +0000
commitb24b1e26e24f18c77035f4255dee90757b08365b (patch)
treee651fe85c06357ee0db3e5b5aceaf320c1b23184 /src/peerinfo-tool/test_gnunet_peerinfo.py.in
parentefbd30b934fa773634dd2b2e18e2824795973bc7 (diff)
downloadgnunet-b24b1e26e24f18c77035f4255dee90757b08365b.tar.gz
gnunet-b24b1e26e24f18c77035f4255dee90757b08365b.zip
Move python test scripts to .py.in and sed in the correct python path.
Diffstat (limited to 'src/peerinfo-tool/test_gnunet_peerinfo.py.in')
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py.in72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
new file mode 100755
index 000000000..ba542f28a
--- /dev/null
+++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
@@ -0,0 +1,72 @@
1#!@PYTHON@
2# This file is part of GNUnet.
3# (C) 2010 Christian Grothoff (and other contributing authors)
4#
5# GNUnet is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published
7# by the Free Software Foundation; either version 2, or (at your
8# option) any later version.
9#
10# GNUnet is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with GNUnet; see the file COPYING. If not, write to the
17# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18# Boston, MA 02111-1307, USA.
19#
20# Testcase for gnunet-peerinfo
21import pexpect
22import os
23import signal
24import re
25
26pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf')
27pinfo.expect ('Timeout trying to interact with PEERINFO service\r')
28pinfo.expect (pexpect.EOF);
29os.system ('rm -rf /tmp/gnunet-test-peerinfo/')
30os.system ('gnunet-arm -sq -c test_gnunet_peerinfo_data.conf')
31
32try:
33 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -s')
34 pinfo.expect (re.compile ("I am peer `.*\'.\r"));
35 pinfo.expect (pexpect.EOF);
36
37 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs')
38 pinfo.expect (re.compile (".......................................................................................................\r"));
39 pinfo.expect (pexpect.EOF);
40
41 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid')
42 pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r"));
43 pinfo.expect (pexpect.EOF);
44
45
46 os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf')
47 os.system ('sleep 1')
48 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf')
49 pinfo.expect (re.compile ("Peer `.*\' with trust *0\r"));
50 pinfo.expect (re.compile (" *localhost:24357\r"));
51 pinfo.expect (pexpect.EOF);
52
53 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -n')
54 pinfo.expect (re.compile ("Peer `.*\' with trust *0\r"));
55 pinfo.expect (re.compile (" *127..*:24357\r"));
56 pinfo.expect (pexpect.EOF);
57
58 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs')
59 pid = pinfo.read (-1)
60 pid = pid.strip ()
61
62 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid)
63 pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r"));
64 pinfo.expect (pexpect.EOF);
65
66 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid)
67 pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r"));
68 pinfo.expect (pexpect.EOF);
69
70finally:
71 os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq')
72 os.system ('rm -rf /tmp/gnunet-test-peerinfo/')