1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 23:53:19 +08:00

t0110: cleanup using expr

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
Christian Couder
2015-03-04 21:02:32 +01:00
parent 32dd4dbfa9
commit b01e535115

View File

@ -66,24 +66,20 @@ test_expect_success "GET invalid path errors" '
test_must_fail wget http://127.0.0.1:$port/12345
'
test_expect_success "GET /webui returns code expected" '
echo "HTTP/1.1 302 Found" | head -c 18 > expected &&
echo "HTTP/1.1 301 Moved Permanently" | head -c 18 > also_ok &&
curl -I http://127.0.0.1:$apiport/webui | head -c 18 > actual1 &&
(test_cmp expected actual1 || test_cmp actual1 also_ok) &&
rm actual1
curl -I http://127.0.0.1:$apiport/webui >actual &&
RESP=$(head -1 actual) &&
(expr "$RESP" : "HTTP/1.1 302 Found\s" ||
expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
'
test_expect_success "GET /webui/ returns code expected" '
curl -I http://127.0.0.1:$apiport/webui/ | head -c 18 > actual2 &&
(test_cmp expected actual2 || test_cmp actual2 also_ok) &&
rm expected &&
rm also_ok &&
rm actual2
curl -I http://127.0.0.1:$apiport/webui/ > actual &&
RESP=$(head -1 actual) &&
(expr "$RESP" : "HTTP/1.1 302 Found\s" ||
expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
'
test_kill_ipfs_daemon
test_done