Add additional tests for importprivkey.

This commit is contained in:
Josh Rickmar 2013-11-20 11:08:20 -05:00
parent 8d9b8fcf82
commit fa2bf4423e
2 changed files with 16 additions and 2 deletions

View file

@ -3586,7 +3586,7 @@ func (cmd *ImportPrivKeyCmd) UnmarshalJSON(b []byte) error {
return err
}
if len(r.Params) > 3 {
if len(r.Params) == 0 || len(r.Params) > 3 {
return ErrWrongNumberOfParams
}

View file

@ -674,7 +674,21 @@ var jsoncmdtests = []struct {
},
},
{
name: "basic importprivkey + opts",
name: "basic importprivkey + 1 opt",
f: func() (Cmd, error) {
return NewImportPrivKeyCmd(float64(1),
"somereallongprivatekey",
"some text")
},
result: &ImportPrivKeyCmd{
id: float64(1),
PrivKey: "somereallongprivatekey",
Label: "some text",
Rescan: true,
},
},
{
name: "basic importprivkey + 2 opts",
f: func() (Cmd, error) {
return NewImportPrivKeyCmd(float64(1),
"somereallongprivatekey",