forked from TheQuestionru/newrelic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
applications_test.go
51 lines (47 loc) · 1.2 KB
/
applications_test.go
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
package newrelic
import (
"fmt"
"net/http"
"testing"
)
func TestGetApplication(t *testing.T) {
t.Logf("Starting TestGetApplication")
for _, tt := range getApplicationTests {
t.Logf("Testing")
h := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
fmt.Fprintf(w, tt.in.data)
}
c, s := initHTTP(t, testAPIKey, h)
defer s.Close()
resp, err := c.GetApplication(tt.in.id)
t.Logf("Checking err...")
expect(t, tt.out.err, err)
t.Logf("Checking output...")
expect(t, tt.out.data, resp)
}
}
func TestGetApplications(t *testing.T) {
t.Logf("Starting TestGetApplication")
for _, tt := range getApplicationsTests {
t.Logf("Testing")
h := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
fmt.Fprintf(w, tt.in.data)
}
c, s := initHTTP(t, testAPIKey, h)
defer s.Close()
resp, err := c.GetApplications(tt.in.options)
t.Logf("Checking err...")
expect(t, tt.out.err, err)
t.Logf("Checking output...")
expect(t, tt.out.data, resp)
}
}
func TestApplicationOptionsStringer(t *testing.T) {
t.Logf("Starting TestApplicationOptionsStringer")
for _, tt := range applicationOptionsStringerTests {
t.Logf("Testing")
expect(t, tt.in.String(), tt.out)
}
}