-
Notifications
You must be signed in to change notification settings - Fork 25
/
versions_test.go
71 lines (56 loc) · 1.39 KB
/
versions_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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package checkpoint
import (
"os"
"reflect"
"strings"
"testing"
)
func TestVersions(t *testing.T) {
t.Skip("endpoint does not exist yet")
expected := &VersionsResponse{
Service: "test.v1",
Product: "test",
Minimum: "1.0",
Excluding: []string{"1.3"},
Maximum: "2.0",
}
actual, err := Versions(&VersionsParams{
Service: "test.v1",
Product: "test",
})
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("expected %#v, got: %#v", expected, actual)
}
}
func TestVersions_timeout(t *testing.T) {
t.Skip("endpoint does not exist yet")
os.Setenv("CHECKPOINT_TIMEOUT", "50")
defer os.Setenv("CHECKPOINT_TIMEOUT", "")
expected := "Client.Timeout exceeded while awaiting headers"
_, err := Versions(&VersionsParams{
Service: "test.v1",
Product: "test",
})
if err == nil || !strings.Contains(err.Error(), expected) {
t.Fatalf("expected a timeout error, got: %v", err)
}
}
func TestVersions_disabled(t *testing.T) {
t.Skip("endpoint does not exist yet")
os.Setenv("CHECKPOINT_DISABLE", "1")
defer os.Setenv("CHECKPOINT_DISABLE", "")
expected := &CheckResponse{}
actual, err := Versions(&VersionsParams{
Service: "test.v1",
Product: "test",
})
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("expected %#v, got: %#v", expected, actual)
}
}