Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
a3b38e8b
Commit
a3b38e8b
authored
Jan 11, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for the keystore
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
4dbb084e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
core/commands/keystore.go
core/commands/keystore.go
+2
-2
test/sharness/t0165-keystore.sh
test/sharness/t0165-keystore.sh
+37
-0
No files found.
core/commands/keystore.go
View file @
a3b38e8b
...
...
@@ -143,7 +143,7 @@ var KeyListCmd = &cmds.Command{
Tagline
:
"List all local keypairs"
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"
show-ids"
,
"l"
,
"also show key ids
"
),
cmds
.
BoolOption
(
"
l"
,
"Show extra information about keys.
"
),
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -189,7 +189,7 @@ var KeyListCmd = &cmds.Command{
}
func
keyOutputListMarshaler
(
res
cmds
.
Response
)
(
io
.
Reader
,
error
)
{
withId
,
_
,
_
:=
res
.
Request
()
.
Option
(
"
show-ids
"
)
.
Bool
()
withId
,
_
,
_
:=
res
.
Request
()
.
Option
(
"
l
"
)
.
Bool
()
list
,
ok
:=
res
.
Output
()
.
(
*
KeyOutputList
)
if
!
ok
{
...
...
test/sharness/t0165-keystore.sh
0 → 100755
View file @
a3b38e8b
#!/bin/sh
#
# Copyright (c) 2017 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test keystore commands"
.
lib/test-lib.sh
test_init_ipfs
test_key_cmd
()
{
test_expect_success
"create a new rsa key"
'
rsahash=$(ipfs key gen foobarsa --type=rsa --size=2048)
'
test_expect_success
"create a new ed25519 key"
'
edhash=$(ipfs key gen bazed --type=ed25519)
'
test_expect_success
"both keys show up in list output"
'
echo bazed > list_exp &&
echo foobarsa >> list_exp &&
ipfs key list | sort > list_out &&
test_cmp list_exp list_out
'
test_expect_success
"key hashes show up in long list output"
'
ipfs key list -l | grep $edhash > /dev/null &&
ipfs key list -l | grep $rsahash > /dev/null
'
}
test_key_cmd
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment