package client import ( "log" "os" "testing" "github.com/stretchr/testify/assert" ) func exists(filename string) bool { if _, err := os.Stat(filename); err == nil { return true } else { return false } } func TestLoad(t *testing.T) { if exists("test.id") { os.Remove("test.id") } id, err := LoadIdentity("test.id", "toto") if err != nil { id := CreateIdentity("myname") id.Save() } else { log.Println(id.Nickname) } id, err = LoadIdentity("test.id", "toto") if err != nil { log.Println(err.Error()) } assert.Equal(t, err, nil, "2nd Load error") assert.Equal(t, id.Nickname, "myname", "The two words should be the same.") if exists("test.id") { os.Remove("test.id") } } func TestCreate(t *testing.T) { }