aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_gnunet_fs_idx.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/test_gnunet_fs_idx.py.in')
-rwxr-xr-xsrc/fs/test_gnunet_fs_idx.py.in57
1 files changed, 48 insertions, 9 deletions
diff --git a/src/fs/test_gnunet_fs_idx.py.in b/src/fs/test_gnunet_fs_idx.py.in
index 4798cf503..2c8c7e8ec 100755
--- a/src/fs/test_gnunet_fs_idx.py.in
+++ b/src/fs/test_gnunet_fs_idx.py.in
@@ -11,7 +11,7 @@
11# WITHOUT ANY WARRANTY; without even the implied warranty of 11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details. 13# Affero General Public License for more details.
14# 14#
15# You should have received a copy of the GNU Affero General Public License 15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# 17#
@@ -43,7 +43,9 @@ elif os.name == 'nt':
43 unindex = './gnunet-unindex.exe' 43 unindex = './gnunet-unindex.exe'
44 44
45if os.name == "nt": 45if os.name == "nt":
46 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True) 46 shutil.rmtree(
47 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True
48 )
47else: 49else:
48 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True) 50 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)
49 51
@@ -53,22 +55,59 @@ arm.communicate()
53try: 55try:
54 pub = pexpect() 56 pub = pexpect()
55 57
56 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 58 pub.spawn(
57 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n")) 59 None, [
60 publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m',
61 "description:Test archive", '-k', 'tst',
62 'test_gnunet_fs_rec_data.tgz'
63 ],
64 stdout=subprocess.PIPE,
65 stderr=subprocess.STDOUT
66 )
67 pub.expect(
68 "stdout",
69 re.compile(
70 r"URI is `gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822'\.\r?\n"
71 )
72 )
58 73
59 down = pexpect() 74 down = pexpect()
60 down.spawn(None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 75 down.spawn(
61 down.expect("stdout", re.compile(r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) 76 None, [
77 download, '-c', 'test_gnunet_fs_idx_data.conf', '-o',
78 'test_gnunet_fs_rec_data.tar.gz',
79 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'
80 ],
81 stdout=subprocess.PIPE,
82 stderr=subprocess.STDOUT
83 )
84 down.expect(
85 "stdout",
86 re.compile(
87 r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n"
88 )
89 )
62 os.remove("test_gnunet_fs_rec_data.tar.gz") 90 os.remove("test_gnunet_fs_rec_data.tar.gz")
63 91
64 un = pexpect() 92 un = pexpect()
65 un.spawn(None, [unindex, '-c', 'test_gnunet_fs_idx_data.conf', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 93 un.spawn(
94 None, [
95 unindex, '-c', 'test_gnunet_fs_idx_data.conf',
96 'test_gnunet_fs_rec_data.tgz'
97 ],
98 stdout=subprocess.PIPE,
99 stderr=subprocess.STDOUT
100 )
66 un.expect("stdout", re.compile(r'Unindexing done\.\r?\n')) 101 un.expect("stdout", re.compile(r'Unindexing done\.\r?\n'))
67 102
68finally: 103finally:
69 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf']) 104 arm = subprocess.Popen([
105 gnunetarm, '-eq', '-c', 'test_gnunet_fs_idx_data.conf'
106 ])
70 arm.communicate() 107 arm.communicate()
71 if os.name == "nt": 108 if os.name == "nt":
72 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True) 109 shutil.rmtree(
110 os.path.join(os.getenv("TEMP"), "gnunet-test-fs-py-idx"), True
111 )
73 else: 112 else:
74 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True) 113 shutil.rmtree("/tmp/gnunet-test-fs-py-idx", True)