31 lines
465 B
Go
31 lines
465 B
Go
package meowlib
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func TestCreate(t *testing.T) {
|
|
id := CreateIdentity("myname")
|
|
id.Save("test.id")
|
|
}
|
|
|
|
func TestSave(t *testing.T) {
|
|
id := Identity{Nickname: "myname",
|
|
PublicKey: "pubk",
|
|
PrivateKey: "privk",
|
|
Status: "online",
|
|
}
|
|
id.Save("test.id")
|
|
}
|
|
|
|
func TestLoad(t *testing.T) {
|
|
id, err := LoadIdentity("test.id")
|
|
if err != nil {
|
|
log.Fatal((err.Error()))
|
|
}
|
|
if id.Nickname != "myname" {
|
|
log.Fatal("failed")
|
|
}
|
|
}
|