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 <steven@stebalien.com>
Steven Allen committed
Mar 18, 2018 at 13:00 UTC
4e9a6c7eab7c70fb51a599739bf831d1826f112f
1 file changed
+23
test/sharness/t0100-name.sh
+23
@@ -90,4 +90,27 @@ test_expect_success "publish an explicit node ID as key name looks good" '
90
test_cmp expected_node_id_publish actual_node_id_publish
91
'
92
93
+
94
+# test publishing nothing
95
+
96
+test_expect_success "'ipfs name publish' fails" '
97
+ PEERID=`ipfs id --format="<id>"` &&
98
+ test_check_peerid "${PEERID}" &&
99
+ printf '' | test_expect_code 1 ipfs name publish >publish_out 2>&1
100
+'
101
+
102
+test_expect_success "publish output has the correct error" '
103
+ grep "argument \"ipfs-path\" is required" publish_out
104
+'
105
+
106
+test_launch_ipfs_daemon
107
+
108
+test_expect_success "empty request to name publish doesn't panic and returns error" '
109
+ curl "http://$API_ADDR/api/v0/name/publish" > curl_out || true &&
110
+ grep "argument \"ipfs-path\" is required" curl_out
111
+'
112
+
113
+test_kill_ipfs_daemon
114
+
115
+
116
test_done