/usr/share/gocode/src/github.com/influxdb/enterprise-client/v1/registration_test.go is in golang-github-influxdb-enterprise-client-dev 0.0~git20151113.0.25665cb-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | package client_test
import (
"fmt"
"testing"
"github.com/influxdb/enterprise-client/v1"
"github.com/stretchr/testify/require"
)
func Test_Client_RegistrationURL(t *testing.T) {
r := require.New(t)
c := client.New("foo")
u, _ := c.RegistrationURL(client.Registration{
ClusterID: "clus1",
Product: "chronograf",
RedirectURL: "http://example.com",
})
r.Equal("https://enterprise.influxdata.com/start?cluster_id=clus1&product=chronograf&redirect_url=http%3A%2F%2Fexample.com", u)
}
func Test_Registration_IsValid(t *testing.T) {
r := require.New(t)
reg := client.Registration{}
err := reg.IsValid()
r.Error(err)
reg.ClusterID = "clus1"
err = reg.IsValid()
r.Error(err)
reg.ClusterID = ""
reg.Product = "foo"
err = reg.IsValid()
r.Error(err)
reg.ClusterID = "clus1"
reg.Product = "foo"
err = reg.IsValid()
r.NoError(err)
}
// Example of getting a registration URL for a product
func Example_registrationURL() {
c := client.New("")
r := client.Registration{
ClusterID: "clus1",
Product: "chronograf",
RedirectURL: "http://example.com",
}
s, _ := c.RegistrationURL(r)
fmt.Printf("s: %s\n", s)
// https://enterprise.influxdata.com/start?cluster_id=clus1&product=chronograf&redirect_url=http%3A%2F%2Fexample.com
}
|