2 # This file is part of GNUnet.
3 # (C) 2010 Christian Grothoff (and other contributing authors)
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.
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.
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.
20 # Testcase for file-sharing command-line tools (recursive publishing & download)
26 os.system ('rm -rf /tmp/gnunet-test-fs-py-rec/')
27 os.system ('gnunet-arm -sq -c test_gnunet_fs_rec_data.conf')
28 os.system ('tar xfz test_gnunet_fs_rec_data.tgz')
30 pub = pexpect.spawn ('gnunet-publish -c test_gnunet_fs_rec_data.conf -d -k testdir dir/')
31 pub.expect ('Publishing `dir/\' done.\r')
32 pub.expect ("URI is `gnunet://fs/chk/CQI091BQ15LLC2NO5RQM2LP95D8I0ONKDFT912V8CMH3BIPDUSDKG3JL07V9E89JPJ0CG5JE9EAQLC1Q6I0VF9L8M86MO0K3DG7HA2O.NVIUL6B7AT6TIUVOV0JLIQ3LLSS3TRLCVAISDS47V0KVHN22TJ9H9247HQNA8T3KK1J32QJ65312DUQPA2EBQPNII279BU0MKJEB94G.20181'.")
33 #pub.expect ("URI is `gnunet://fs/chk/8PNDC5FDF7T57HUGM9ODSL7CDKNOLPUFDCJQQ2MPP4SUPSEAJP1LNLBMEFN21KAG0KNVG3LG2AJCV322G3ECU6GKM9HFCVKM78LKEUO.9MI810JGAE6QVQMTBBVO2E92PA3C1MVF511CGKIPBMJ1B0PERIBDK9TNVD2JB4E4NFTD5F8QORJ644CUC281PISDND1NVGC7PB14388.20173'.")
34 pub.expect (pexpect.EOF)
36 down = pexpect.spawn ('gnunet-download -c test_gnunet_fs_rec_data.conf -R -o rdir.gnd gnunet://fs/chk/CQI091BQ15LLC2NO5RQM2LP95D8I0ONKDFT912V8CMH3BIPDUSDKG3JL07V9E89JPJ0CG5JE9EAQLC1Q6I0VF9L8M86MO0K3DG7HA2O.NVIUL6B7AT6TIUVOV0JLIQ3LLSS3TRLCVAISDS47V0KVHN22TJ9H9247HQNA8T3KK1J32QJ65312DUQPA2EBQPNII279BU0MKJEB94G.20181')
37 #down = pexpect.spawn ('gnunet-download -c test_gnunet_fs_rec_data.conf -R -o rdir.gnd gnunet://fs/chk/8PNDC5FDF7T57HUGM9ODSL7CDKNOLPUFDCJQQ2MPP4SUPSEAJP1LNLBMEFN21KAG0KNVG3LG2AJCV322G3ECU6GKM9HFCVKM78LKEUO.9MI810JGAE6QVQMTBBVO2E92PA3C1MVF511CGKIPBMJ1B0PERIBDK9TNVD2JB4E4NFTD5F8QORJ644CUC281PISDND1NVGC7PB14388.20173')
39 down.expect (re.compile ("Downloading `rdir.gnd\' done \(.*\).\r"));
40 down.expect (pexpect.EOF);
42 dir = pexpect.spawn ('gnunet-directory -c test_gnunet_fs_rec_data.conf rdir/a.gnd')
43 dir.expect (re.compile (" last: a"));
44 dir.expect (re.compile (" last: COPYING"));
45 # dir.expect (re.compile (" *embedded filename: a"));
46 # dir.expect (re.compile (" *embedded filename: COPYING"));
47 dir.expect (pexpect.EOF)
49 os.system ('rm -r rdir/b.gnd rdir/a.gnd')
50 if (0 != os.system ("diff -r dir rdir")):
51 raise Exception ("Unexpected difference between source directory and downloaded result")
54 os.system ('gnunet-arm -c test_gnunet_fs_rec_data.conf -eq')
55 os.system ('rm -r dir rdir rdir.gnd')
56 os.system ('rm -rf /tmp/gnunet-test-fs-py-rec/')