Skip to content

Commit

Permalink
sharness: add test for 'ipfs config replace'
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Sep 8, 2016
1 parent 0f0cf44 commit 077948a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/sharness/t0021-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ test_config_cmd() {
grep "\"beep3\": false," actual
'

test_expect_success "'ipfs config replace' works" '
cp "$IPFS_PATH/config" newconfig.json &&
sed -i -e /PrivKey/d -e s/10GB/11GB/ newconfig.json &&
sed -i '"'"'/PeerID/ { s/,$// } '"'"' newconfig.json &&
ipfs config replace - < newconfig.json &&
sed -e /PrivKey/d "$IPFS_PATH/config" > replconfig.json &&
sed -i -e'"'"'/PeerID/ { s/,$// } '"'"' replconfig.json &&
test_cmp replconfig.json newconfig.json
'

# SECURITY
# Those tests are here to prevent exposing the PrivKey on the network

test_expect_success "'ipfs config Identity' fails" '
test_expect_code 1 ipfs config Identity 2> ident_out
'
Expand All @@ -81,8 +94,6 @@ test_config_cmd() {
test_cmp ident_exp ident_out
'

# SECURITY
# Those tests are here to prevent exposing the PrivKey on the network
test_expect_success "'ipfs config Identity.PrivKey' fails" '
test_expect_code 1 ipfs config Identity.PrivKey 2> ident_out
'
Expand Down

0 comments on commit 077948a

Please sign in to comment.