40 lines
691 B
Go
40 lines
691 B
Go
|
package reachview
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"forge.cadoles.com/Pyxis/orion/emlid"
|
||
|
"github.com/davecgh/go-spew/spew"
|
||
|
)
|
||
|
|
||
|
func TestReachViewStatusBroadcast(t *testing.T) {
|
||
|
|
||
|
if !*runReachViewIntegrationTests {
|
||
|
t.Skip("To run this test, use: go test -reachview-integration")
|
||
|
}
|
||
|
|
||
|
client := NewClient(
|
||
|
emlid.WithStandardLogger(),
|
||
|
emlid.WithEndpoint(*reachHost, 80),
|
||
|
)
|
||
|
if err := client.Connect(); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
defer client.Close()
|
||
|
|
||
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||
|
defer cancel()
|
||
|
|
||
|
statuses, err := client.StatusBroadcast(ctx)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
for s := range statuses {
|
||
|
spew.Dump(s)
|
||
|
}
|
||
|
|
||
|
}
|