@cryptotaxi247 / kubo / commits / c0a04a06c

add sharness test for ipfs key rename

License: MIT Signed-off-by: Michael Muré <batolettre@gmail.com>

Michael Muré committed May 4, 2017 at 21:56 UTC c0a04a06c39064f6bf40677e43d12ec6183ad578
1 file changed +18
test/sharness/t0165-keystore.sh
+18
@@ -44,6 +44,24 @@ test_key_cmd() {
44 ipfs key list | sort > list_out &&
45 test_cmp list_exp list_out
46 '
47 +
48 + test_expect_success "key rename rename a key" '
49 + ipfs key rename bazed fooed
50 + echo fooed > list_exp &&
51 + echo self >> list_exp
52 + ipfs key list | sort > list_out &&
53 + test_cmp list_exp list_out
54 + '
55 +
56 + test_expect_success "key rename can't remove self" '
57 + test_must_fail ipfs key rename self bar 2>&1 | tee key_rename_out &&
58 + grep -q "Error: cannot rename key with name" key_rename_out
59 + '
60 +
61 + test_expect_success "key rename can't overwrite self, even with force" '
62 + test_must_fail ipfs key rename -f fooed self 2>&1 | tee key_rename_out &&
63 + grep -q "Error: cannot overwrite key with name" key_rename_out
64 + '
65 }
66
67 test_key_cmd