-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
47 lines (38 loc) · 760 Bytes
/
client_test.go
File metadata and controls
47 lines (38 loc) · 760 Bytes
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
package redmine_test
import (
"os"
"testing"
"github.com/ryodocx/go-redmine"
)
var (
client *redmine.Client
baseURL, apiKey string
)
func init() {
baseURL = os.Getenv("REDMINE_BASEURL")
if baseURL == "" {
panic("REDMINE_BASEURL is required!")
}
apiKey = os.Getenv("REDMINE_APIKEY")
if apiKey == "" {
panic("REDMINE_APIKEY is required!")
}
if c, err := redmine.NewClient(baseURL, apiKey, redmine.OptionDebugMode(true)); err != nil {
panic(err)
} else {
client = c
}
}
func Example() {
client, err := redmine.NewClient(baseURL, apiKey)
if err != nil {
panic(err)
}
_ = client.HealthCheck()
// client.GetXxx...
}
func TestHealthCheck(t *testing.T) {
if err := client.HealthCheck(); err != nil {
t.Fatal(err)
}
}