From c0a04a06c39064f6bf40677e43d12ec6183ad578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Thu, 4 May 2017 21:56:58 +0900 Subject: [PATCH] add sharness test for ipfs key rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Michael Muré --- test/sharness/t0165-keystore.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/sharness/t0165-keystore.sh b/test/sharness/t0165-keystore.sh index 78bc9d646..8ba5f6138 100755 --- a/test/sharness/t0165-keystore.sh +++ b/test/sharness/t0165-keystore.sh @@ -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