getting mysql to work
[oweals/gnunet.git] / src / fs / test_gnunet_fs_psd.py.in
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 file-sharing command-line tools (publish, search, download)
21 import pexpect
22 import os
23 import signal
24 import re
25
26 os.system ('rm -rf /tmp/gnunet-test-fs-py-psd/')
27 os.system ('gnunet-arm -sq -c test_gnunet_fs_psd_data.conf')
28 try:
29 # first, basic publish-search-download run
30   pub = pexpect.spawn ('gnunet-publish -n -c test_gnunet_fs_psd_data.conf -m "description:The GNU Public License" -k gpl ../../COPYING')
31   pub.expect ('Publishing `../../COPYING\' done.\r')
32   pub.expect ("URI is `gnunet://fs/chk/PC0M19QMQC0BPSHR6BGA228PP6INER1D610MGEMOMEM87222FN8HVUO7PQGO0O9HD2GVLHF2N5IDHEQUNK6LKE428FPO96SKQEA486O.PG7K85JGQ6N599MD5HEP3CHEVFPKQD9JB6NPSLVA3T1SKDS66CFI499VS6MGQ88B0QUAVT1282TCRD4GGFVUKDLGI8F0SPIANA3J2LG.35147'.\r")
33   pub.expect (pexpect.EOF)
34
35   search = pexpect.spawn ('gnunet-search -V -c test_gnunet_fs_psd_data.conf gpl')
36   search.expect ("gnunet-download -o \"COPYING\" gnunet://fs/chk/PC0M19QMQC0BPSHR6BGA228PP6INER1D610MGEMOMEM87222FN8HVUO7PQGO0O9HD2GVLHF2N5IDHEQUNK6LKE428FPO96SKQEA486O.PG7K85JGQ6N599MD5HEP3CHEVFPKQD9JB6NPSLVA3T1SKDS66CFI499VS6MGQ88B0QUAVT1282TCRD4GGFVUKDLGI8F0SPIANA3J2LG.35147\r")
37   search.expect (re.compile (" *description: The GNU Public License\r"));
38   search.kill (signal.SIGTERM)
39   search.expect (pexpect.EOF)
40   
41   down = pexpect.spawn ('gnunet-download -c test_gnunet_fs_psd_data.conf -o \"COPYING\" gnunet://fs/chk/PC0M19QMQC0BPSHR6BGA228PP6INER1D610MGEMOMEM87222FN8HVUO7PQGO0O9HD2GVLHF2N5IDHEQUNK6LKE428FPO96SKQEA486O.PG7K85JGQ6N599MD5HEP3CHEVFPKQD9JB6NPSLVA3T1SKDS66CFI499VS6MGQ88B0QUAVT1282TCRD4GGFVUKDLGI8F0SPIANA3J2LG.35147')
42   down.expect (re.compile ("Downloading `COPYING\' done \(.*\).\r"));
43   down.expect (pexpect.EOF);
44   os.system ('rm COPYING');
45
46 finally:
47   os.system ('gnunet-arm -c test_gnunet_fs_psd_data.conf -eq')
48   os.system ('rm -rf /tmp/gnunet-test-fs-py-psd/')