orion/emlid/reachview/project_test.go

45 lines
794 B
Go

package reachview
import (
"context"
"fmt"
"testing"
"time"
"forge.cadoles.com/Pyxis/orion/emlid"
)
func TestReachViewProjectCRUD(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)
}
ctx, cancelCreateProject := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelCreateProject()
project := &Project{
Name: fmt.Sprintf("Test-%d", time.Now().Unix()),
}
projectID, err := client.CreateProject(ctx, project)
if err != nil {
t.Error(err)
}
if projectID == "" {
t.Errorf("projectID should not be empty")
}
defer client.Close()
}