diff options
Diffstat (limited to 'src/peerinfo-tool/test_gnunet_peerinfo.py')
-rwxr-xr-x | src/peerinfo-tool/test_gnunet_peerinfo.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py b/src/peerinfo-tool/test_gnunet_peerinfo.py new file mode 100755 index 000000000..3aa8497af --- /dev/null +++ b/src/peerinfo-tool/test_gnunet_peerinfo.py | |||
@@ -0,0 +1,56 @@ | |||
1 | #!/usr/bin/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 | ||
21 | import pexpect | ||
22 | import os | ||
23 | import signal | ||
24 | import re | ||
25 | |||
26 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') | ||
27 | pinfo.expect ('Timeout trying to interact with PEERINFO service\r') | ||
28 | pinfo.expect (pexpect.EOF); | ||
29 | os.system ('rm -rf /tmp/gnunet-test-peerinfo/') | ||
30 | os.system ('gnunet-arm -sq -c test_gnunet_peerinfo_data.conf') | ||
31 | |||
32 | try: | ||
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 | os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') | ||
42 | |||
43 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') | ||
44 | pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); | ||
45 | pinfo.expect (re.compile (" *localhost:24357\r")); | ||
46 | pinfo.expect (pexpect.EOF); | ||
47 | |||
48 | pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -n') | ||
49 | pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); | ||
50 | pinfo.expect (re.compile (" *127.0.0.1:24357\r")); | ||
51 | pinfo.expect (pexpect.EOF); | ||
52 | |||
53 | |||
54 | finally: | ||
55 | os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') | ||
56 | os.system ('rm -rf /tmp/gnunet-test-peerinfo/') | ||