meowlib/client/serverstorage_test.go
ycc 978b6fdfd1
Some checks failed
continuous-integration/drone/push Build is failing
badgerdb messageservers storage
2024-02-08 22:17:16 +01:00

34 lines
584 B
Go

package client
import (
"log"
"testing"
"forge.redroom.link/yves/meowlib"
)
func TestStoreServer(t *testing.T) {
GetConfig().SetMemPass("test")
ss := ServerStorage{DbFile: "test.db"}
srv := Server{
Name: "test",
Url: "http://127.0.0.1",
PublicKey: meowlib.NewKeyPair().Public,
}
err := ss.StoreServer(&srv)
if err != nil {
log.Fatal(err)
}
sout, err := ss.LoadServer(srv.GetServerCard().GetUid())
if err != nil {
log.Fatal(err)
}
if sout == nil {
log.Fatal("server not found")
}
if sout.Name != srv.Name {
log.Fatal("name not found")
}
}