Unverified 提交 053f1234 作者: Whyrusleeping 提交者: GitHub

Merge pull request #4962 from grokcoder/fix/core/commands

Fix key rename command output error
......@@ -306,7 +306,11 @@ var keyRenameCmd = &cmds.Command{
},
Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) (io.Reader, error) {
k, ok := res.Output().(*KeyRenameOutput)
v, err := unwrapOutput(res.Output())
if err != nil {
return nil, err
}
k, ok := v.(*KeyRenameOutput)
if !ok {
return nil, fmt.Errorf("expected a KeyRenameOutput as command result")
}
......
......@@ -58,6 +58,13 @@ test_key_cmd() {
test_cmp list_exp list_out
'
test_expect_success "key rename rename key output succeeds" '
key_content=$(ipfs key gen key1 --type=rsa --size=2048) &&
ipfs key rename key1 key2 >rs &&
echo "Key $key_content renamed to key2" >expect &&
test_cmp rs expect
'
test_expect_success "key rename can't rename 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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论