Skip to content

Commit

Permalink
cmd: account unittests use t.Error() instead of t.Fatal, renamed Test…
Browse files Browse the repository at this point in the history
…*() functions
  • Loading branch information
randomshinichi committed Feb 28, 2019
1 parent 5093af2 commit 84719cd
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions cmd/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,100 +8,100 @@ import (
"github.com/spf13/cobra"
)

func TestCreate(t *testing.T) {
func TestAccountCreate(t *testing.T) {
password = "password"
emptyCmd := cobra.Command{}

dir, err := ioutil.TempDir("", "aecli")
if err != nil {
t.Fatal(err)
t.Error(err)
}
defer os.RemoveAll(dir)
os.Chdir(dir)

err = createFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}
}

func TestAddress(t *testing.T) {
func TestAccountAddress(t *testing.T) {
password = "password"
emptyCmd := cobra.Command{}

dir, err := ioutil.TempDir("", "aecli")
if err != nil {
t.Fatal(err)
t.Error(err)
}
defer os.RemoveAll(dir)
os.Chdir(dir)

err = createFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}

err = addressFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}
}

func TestSave(t *testing.T) {
func TestAccountSave(t *testing.T) {
password = "password"
emptyCmd := cobra.Command{}
privateKey := "025528252ec5db7d77cd57e14ae7819b9205c84abe5eef8353f88330467048f458019537ef2e809fefe1f2513cda8c8aacc74fb30f8c1f8b32d99a16b7f539b8"
dir, err := ioutil.TempDir("", "aecli")
if err != nil {
t.Fatal(err)
t.Error(err)
}
defer os.RemoveAll(dir)
os.Chdir(dir)

err = saveFunc(&emptyCmd, []string{"test.json", privateKey})
if err != nil {
t.Fatal(err)
t.Error(err)
}
}

func TestBalance(t *testing.T) {
func TestAccountBalance(t *testing.T) {
setCLIConfig()
password = "password"
emptyCmd := cobra.Command{}
dir, err := ioutil.TempDir("", "aecli")
if err != nil {
t.Fatal(err)
t.Error(err)
}
defer os.RemoveAll(dir)
os.Chdir(dir)

err = createFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}
err = balanceFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}
}

func TestSign(t *testing.T) {
func TestAccountSign(t *testing.T) {
password = "password"
emptyCmd := cobra.Command{}
dir, err := ioutil.TempDir("", "aecli")
if err != nil {
t.Fatal(err)
t.Error(err)
}
defer os.RemoveAll(dir)
os.Chdir(dir)

err = createFunc(&emptyCmd, []string{"test.json"})
if err != nil {
t.Fatal(err)
t.Error(err)
}

err = signFunc(&emptyCmd, []string{"test.json", "tx_+E8MAaEBzqet5HDJ+Z2dTkAIgKhvHUm7REti8Rqeu2S7z+tz/vOhAR8To7CL8AFABmKmi2nYdfeAPOxMCGR/btXYTHiXvVCjCoJOIIKC5wGAkBVBMQ=="})
if err != nil {
t.Fatal(err)
t.Error(err)
}
}

0 comments on commit 84719cd

Please sign in to comment.