@cryptotaxi247 / kubo / commits / b01e53511

t0110: cleanup using expr

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Mar 4, 2015 at 21:02 UTC b01e535115f2977921ad90fb0e52cebbc38dbff7
1 file changed +8 -12
test/sharness/t0110-gateway.sh
+8 -12
@@ -66,24 +66,20 @@ test_expect_success "GET invalid path errors" '
66 test_must_fail wget http://127.0.0.1:$port/12345
67 '
68
69 -
69 test_expect_success "GET /webui returns code expected" '
71 - echo "HTTP/1.1 302 Found" | head -c 18 > expected &&
72 - echo "HTTP/1.1 301 Moved Permanently" | head -c 18 > also_ok &&
73 - curl -I http://127.0.0.1:$apiport/webui | head -c 18 > actual1 &&
74 - (test_cmp expected actual1 || test_cmp actual1 also_ok) &&
75 - rm actual1
70 + curl -I http://127.0.0.1:$apiport/webui >actual &&
71 + RESP=$(head -1 actual) &&
72 + (expr "$RESP" : "HTTP/1.1 302 Found\s" ||
73 + expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
74 '
75
76 test_expect_success "GET /webui/ returns code expected" '
79 - curl -I http://127.0.0.1:$apiport/webui/ | head -c 18 > actual2 &&
80 - (test_cmp expected actual2 || test_cmp actual2 also_ok) &&
81 - rm expected &&
82 - rm also_ok &&
83 - rm actual2
77 + curl -I http://127.0.0.1:$apiport/webui/ > actual &&
78 + RESP=$(head -1 actual) &&
79 + (expr "$RESP" : "HTTP/1.1 302 Found\s" ||
80 + expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
81 '
82
86 -
83 test_kill_ipfs_daemon
84
85 test_done