From 4e9a6c7eab7c70fb51a599739bf831d1826f112f Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 18 Mar 2018 13:00:17 -0700 Subject: [PATCH] add regression test for #4823 for both online and offline mode (tests both the cli and the api) License: MIT Signed-off-by: Steven Allen --- test/sharness/t0100-name.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/sharness/t0100-name.sh b/test/sharness/t0100-name.sh index bbe9922d8..d32b5101e 100755 --- a/test/sharness/t0100-name.sh +++ b/test/sharness/t0100-name.sh @@ -90,4 +90,27 @@ test_expect_success "publish an explicit node ID as key name looks good" ' test_cmp expected_node_id_publish actual_node_id_publish ' + +# test publishing nothing + +test_expect_success "'ipfs name publish' fails" ' + PEERID=`ipfs id --format=""` && + test_check_peerid "${PEERID}" && + printf '' | test_expect_code 1 ipfs name publish >publish_out 2>&1 +' + +test_expect_success "publish output has the correct error" ' + grep "argument \"ipfs-path\" is required" publish_out +' + +test_launch_ipfs_daemon + +test_expect_success "empty request to name publish doesn't panic and returns error" ' + curl "http://$API_ADDR/api/v0/name/publish" > curl_out || true && + grep "argument \"ipfs-path\" is required" curl_out +' + +test_kill_ipfs_daemon + + test_done