started to implement the key generator
This commit is contained in:
1 parent
ad4510711e
commit
776c73b91c
7 files changed
+233
-2
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/codegangsta/cli"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreateKeyCommand(t *testing.T) {
|
||||
c := createKeyCommand
|
||||
hasBeenCalled := false
|
||||
c.Action = func(c *cli.Context) {
|
||||
if c.Int("size") != 22 {
|
||||
t.Error("wrong size")
|
||||
}
|
||||
if c.String("password") != "money" {
|
||||
t.Error("wrong password")
|
||||
}
|
||||
hasBeenCalled = true
|
||||
}
|
||||
app := cli.NewApp()
|
||||
app.Commands = []cli.Command{c}
|
||||
args := []string{"file", "createkey", "-size", "22", "-password", "money"}
|
||||
app.Run(args)
|
||||
if !hasBeenCalled {
|
||||
t.Error("sub command *createkey* has not been called")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user