@cryptotaxi247 / kubo / commits / 6bd524fa3

correctly test refs local

We expect it to return a command error, not a 404, because `local` will be interpreted as a path. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Dec 15, 2017 at 11:07 UTC 6bd524fa3a76abed65cc3f7cfa01a602920fc74a
1 file changed +7 -1
test/sharness/t0110-gateway.sh
+7 -1
@@ -153,7 +153,6 @@ for cmd in add \
153 object/patch \
154 pin \
155 ping \
156 - refs/local \
156 repo \
157 stats \
158 swarm \
@@ -166,6 +165,13 @@ do
165 '
166 done
167
168 +# This one is different. `local` will be interpreted as a path if the command isn't defined.
169 +test_expect_success "test gateway api is sanitized: refs/local" '
170 + echo "Error: invalid '"'ipfs ref'"' path" > refs_local_expected &&
171 + ! ipfs --api /ip4/127.0.0.1/tcp/$port refs local > refs_local_actual 2>&1 &&
172 + test_cmp refs_local_expected refs_local_actual
173 + '
174 +
175 test_expect_success "create raw-leaves node" '
176 echo "This is RAW!" > rfile &&
177 echo "This is RAW!" | ipfs add --raw-leaves -q > rhash