-
Notifications
You must be signed in to change notification settings - Fork 2
/
load_balancers_default_test.go
107 lines (96 loc) · 2.16 KB
/
load_balancers_default_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Code generated by go generate; DO NOT EDIT.
package brightbox
import (
"path"
"testing"
"time"
"gotest.tools/v3/assert"
)
func TestLoadBalancers(t *testing.T) {
instance := testAll(
t,
(*Client).LoadBalancers,
"LoadBalancer",
"load_balancers",
"LoadBalancers",
)
assert.Equal(t, instance.ID, "lba-1235f")
}
func TestLoadBalancer(t *testing.T) {
instance := testInstance(
t,
(*Client).LoadBalancer,
"LoadBalancer",
path.Join("load_balancers", "lba-1235f"),
"load_balancer",
"lba-1235f",
)
assert.Equal(t, instance.ID, "lba-1235f")
}
func TestCreateLoadBalancer(t *testing.T) {
newResource := LoadBalancerOptions{}
instance := testModify(
t,
(*Client).CreateLoadBalancer,
newResource,
"load_balancer",
"POST",
path.Join("load_balancers"),
"{}",
)
assert.Equal(t, instance.ID, "lba-1235f")
}
func TestUpdateLoadBalancer(t *testing.T) {
updatedResource := LoadBalancerOptions{ID: "lba-1235f"}
instance := testModify(
t,
(*Client).UpdateLoadBalancer,
updatedResource,
"load_balancer",
"PUT",
path.Join("load_balancers", updatedResource.ID),
"{}",
)
assert.Equal(t, instance.ID, updatedResource.ID)
}
func TestDestroyLoadBalancer(t *testing.T) {
deletedResource := testModify(
t,
(*Client).DestroyLoadBalancer,
"lba-1235f",
"load_balancer",
"DELETE",
path.Join("load_balancers", "lba-1235f"),
"",
)
assert.Equal(t, deletedResource.ID, "lba-1235f")
}
func TestLockLoadBalancer(t *testing.T) {
lockedResource := testModify(
t,
(*Client).LockLoadBalancer,
"lba-1235f",
"load_balancer",
"PUT",
path.Join("load_balancers", "lba-1235f", "lock_resource"),
"",
)
assert.Equal(t, lockedResource.ID, "lba-1235f")
}
func TestUnlockLoadBalancer(t *testing.T) {
unlockedResource := testModify(
t,
(*Client).UnlockLoadBalancer,
"lba-1235f",
"load_balancer",
"PUT",
path.Join("load_balancers", "lba-1235f", "unlock_resource"),
"",
)
assert.Equal(t, unlockedResource.ID, "lba-1235f")
}
func TestLoadBalancerCreatedAtUnix(t *testing.T) {
tm := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
target := LoadBalancer{CreatedAt: &tm}
assert.Equal(t, target.CreatedAtUnix(), tm.Unix())
}