This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/emlid/reachview/project_test.go

45 lines
794 B
Go
Raw Normal View History

2018-09-26 16:59:46 +02:00
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()
}