mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:30:39 +08:00
add sharness test for ipfs key rename
License: MIT Signed-off-by: Michael Muré <batolettre@gmail.com>
This commit is contained in:
@ -44,6 +44,24 @@ test_key_cmd() {
|
||||
ipfs key list | sort > list_out &&
|
||||
test_cmp list_exp list_out
|
||||
'
|
||||
|
||||
test_expect_success "key rename rename a key" '
|
||||
ipfs key rename bazed fooed
|
||||
echo fooed > list_exp &&
|
||||
echo self >> list_exp
|
||||
ipfs key list | sort > list_out &&
|
||||
test_cmp list_exp list_out
|
||||
'
|
||||
|
||||
test_expect_success "key rename can't remove self" '
|
||||
test_must_fail ipfs key rename self bar 2>&1 | tee key_rename_out &&
|
||||
grep -q "Error: cannot rename key with name" key_rename_out
|
||||
'
|
||||
|
||||
test_expect_success "key rename can't overwrite self, even with force" '
|
||||
test_must_fail ipfs key rename -f fooed self 2>&1 | tee key_rename_out &&
|
||||
grep -q "Error: cannot overwrite key with name" key_rename_out
|
||||
'
|
||||
}
|
||||
|
||||
test_key_cmd
|
||||
|
Reference in New Issue
Block a user