2018-03-09 20:44:13 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.mascherari.press/cwtch/protocol"
|
|
|
|
"git.mascherari.press/cwtch/storage"
|
|
|
|
"github.com/s-rah/go-ricochet/application"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestServerInstance(t *testing.T) {
|
2018-03-14 22:23:35 +00:00
|
|
|
si := new(Instance)
|
2018-03-09 20:44:13 +00:00
|
|
|
ai := new(application.ApplicationInstance)
|
|
|
|
ra := new(application.RicochetApplication)
|
|
|
|
msi := new(storage.MessageStore)
|
|
|
|
os.Remove("ms.test")
|
|
|
|
msi.Init("ms.test")
|
|
|
|
gm := protocol.GroupMessage{
|
|
|
|
Ciphertext: []byte("Hello this is a fairly average length message that we are writing here."),
|
|
|
|
Spamguard: []byte{},
|
|
|
|
}
|
|
|
|
|
|
|
|
si.Init(ai, ra, msi)
|
|
|
|
msi.AddMessage(gm)
|
|
|
|
res := si.HandleFetchRequest()
|
|
|
|
|
|
|
|
if len(res) != 1 {
|
|
|
|
t.Errorf("Expected Group Messages Instead got %v", res)
|
|
|
|
}
|
|
|
|
}
|