From 6bd524fa3a76abed65cc3f7cfa01a602920fc74a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 15 Dec 2017 11:07:32 -0800 Subject: [PATCH] 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 --- test/sharness/t0110-gateway.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/sharness/t0110-gateway.sh b/test/sharness/t0110-gateway.sh index fa04e7cff..c5a4aa39c 100755 --- a/test/sharness/t0110-gateway.sh +++ b/test/sharness/t0110-gateway.sh @@ -153,7 +153,6 @@ for cmd in add \ object/patch \ pin \ ping \ - refs/local \ repo \ stats \ swarm \ @@ -166,6 +165,13 @@ do ' done +# This one is different. `local` will be interpreted as a path if the command isn't defined. +test_expect_success "test gateway api is sanitized: refs/local" ' + echo "Error: invalid '"'ipfs ref'"' path" > refs_local_expected && + ! ipfs --api /ip4/127.0.0.1/tcp/$port refs local > refs_local_actual 2>&1 && + test_cmp refs_local_expected refs_local_actual + ' + test_expect_success "create raw-leaves node" ' echo "This is RAW!" > rfile && echo "This is RAW!" | ipfs add --raw-leaves -q > rhash