-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathhuman_test.go
218 lines (193 loc) · 6.92 KB
/
human_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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
package e2e_test
import (
"testing"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/test/v1"
)
func TestTestCommand(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test -h",
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
}
func TestHumanCreate(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human create -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("simple", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Cmd: "scw test human create",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("with args", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Cmd: "scw test human create height=170.5 shoe-size=35.1 altitude-in-meter=-12 altitude-in-millimeter=-12050 fingers-count=21 hair-count=9223372036854775808 is-happy=true eyes-color=amber organization-id=b3ba839a-dcf2-4b0a-ac81-fc32370052a0",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("invalid boolean", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Cmd: "scw test human create is-happy=so-so",
Check: core.TestCheckCombine(
core.TestCheckExitCode(1),
core.TestCheckGolden(),
),
}))
}
func TestHumanList(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human list -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("simple", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
BeforeFunc: core.BeforeFuncCombine(
core.ExecBeforeCmd("scw test human create"),
core.ExecBeforeCmd("scw test human create"),
core.ExecBeforeCmd("scw test human create"),
),
Cmd: "scw test human list",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
}
func TestHumanUpdate(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human update -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("single arg", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
BeforeFunc: core.ExecBeforeCmd("scw test human create height=170.5 shoe-size=35.1 altitude-in-meter=-12 altitude-in-millimeter=-12050 fingers-count=21 hair-count=9223372036854775808 is-happy=true eyes-color=amber organization-id=b3ba839a-dcf2-4b0a-ac81-fc32370052a0"),
Cmd: "scw test human update 0194fdc2-fa2f-fcc0-41d3-ff12045b73c8 is-happy=false",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("multiple args", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
BeforeFunc: core.ExecBeforeCmd("scw test human create"),
Cmd: "scw test human update 0194fdc2-fa2f-fcc0-41d3-ff12045b73c8 height=155.666 shoe-size=36.0 altitude-in-meter=2147483647 altitude-in-millimeter=2147483647285 fingers-count=20 hair-count=9223372036854775809 is-happy=true eyes-color=blue",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
}
func TestHumanGet(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human get -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("simple", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
BeforeFunc: core.ExecBeforeCmd("scw test human create height=155.666 shoe-size=36.0 altitude-in-meter=2147483647 altitude-in-millimeter=2147483647285 fingers-count=20 hair-count=9223372036854775809 is-happy=true eyes-color=blue organization-id=b3ba839a-dcf2-4b0a-ac81-fc32370052a0"),
Cmd: "scw test human get 0194fdc2-fa2f-fcc0-41d3-ff12045b73c8",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("pass human UUID without arg", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Cmd: "scw test human get 11111111-1111-1111-1111-111111111111",
Check: core.TestCheckCombine(
core.TestCheckExitCode(1),
core.TestCheckGolden(),
),
}))
t.Run("invalid arg name", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
Cmd: "scw test human get 11111111-1111-1111-1111-111111111111 invalid=true",
Check: core.TestCheckCombine(
core.TestCheckExitCode(1),
core.TestCheckGolden(),
),
}))
}
func TestHumanDelete(t *testing.T) {
t.Skip("Test API not available")
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human delete -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
t.Run("simple", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
UseE2EClient: true,
DisableParallel: true, // because e2e client is used
BeforeFunc: core.ExecBeforeCmd("scw test human create height=155.666 shoe-size=36.0 altitude-in-meter=2147483647 altitude-in-millimeter=2147483647285 fingers-count=20 hair-count=9223372036854775809 is-happy=true eyes-color=blue organization-id=b3ba839a-dcf2-4b0a-ac81-fc32370052a0"),
Cmd: "scw test human delete 0194fdc2-fa2f-fcc0-41d3-ff12045b73c8",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
}
func TestHumanRun(t *testing.T) {
t.Run("usage", core.Test(&core.TestConfig{
Commands: test.GetCommands(),
Cmd: "scw test human run -h",
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
),
}))
}