@cryptotaxi247 / kubo / commits / de702ead3

add sharness test to verify requests look good

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Dec 28, 2015 at 05:01 UTC de702ead33d391ea9e254a822e466829ff12f1c0
1 file changed +33
test/sharness/t0235-cli-request.sh new
+33
@@ -0,0 +1,33 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2015 Jeromy Johnson
4 +# MIT Licensed; see the LICENSE file in this repository.
5 +#
6 +
7 +test_description="test http requests made by cli"
8 +
9 +. lib/test-lib.sh
10 +
11 +test_init_ipfs
12 +test_launch_ipfs_daemon
13 +
14 +test_expect_success "can make http request against nc server" '
15 + go-sleep 0.5s | nc -l 5005 > nc_out &
16 + ipfs cat /ipfs/Qmabcdef --api /ip4/127.0.0.1/tcp/5005 || true
17 +'
18 +
19 +test_expect_success "output does not contain multipart info" '
20 + test_expect_code 1 grep multipart nc_out
21 +'
22 +
23 +test_expect_success "request looks good" '
24 + grep "POST /api/v0/cat" nc_out
25 +'
26 +
27 +test_expect_success "api flag does not appear in request" '
28 + test_expect_code 1 grep "api=/ip4" nc_out
29 +'
30 +
31 +test_kill_ipfs_daemon
32 +
33 +test_done