badgerdb messageservers storage
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
33
client/serverstorage_test.go
Normal file
33
client/serverstorage_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
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")
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user