@@ -14,68 +14,6 @@ import (
14
14
"github.com/google/go-cmp/cmp"
15
15
)
16
16
17
- func TestBillingService_GetActionsBillingOrg (t * testing.T ) {
18
- t .Parallel ()
19
- client , mux , _ := setup (t )
20
-
21
- mux .HandleFunc ("/orgs/o/settings/billing/actions" , func (w http.ResponseWriter , r * http.Request ) {
22
- testMethod (t , r , "GET" )
23
- fmt .Fprint (w , `{
24
- "total_minutes_used": 305.0,
25
- "total_paid_minutes_used": 0.0,
26
- "included_minutes": 3000.0,
27
- "minutes_used_breakdown": {
28
- "UBUNTU": 205,
29
- "MACOS": 10,
30
- "WINDOWS": 90
31
- }
32
- }` )
33
- })
34
-
35
- ctx := context .Background ()
36
- hook , _ , err := client .Billing .GetActionsBillingOrg (ctx , "o" )
37
- if err != nil {
38
- t .Errorf ("Billing.GetActionsBillingOrg returned error: %v" , err )
39
- }
40
-
41
- want := & ActionBilling {
42
- TotalMinutesUsed : 305.0 ,
43
- TotalPaidMinutesUsed : 0.0 ,
44
- IncludedMinutes : 3000.0 ,
45
- MinutesUsedBreakdown : MinutesUsedBreakdown {
46
- "UBUNTU" : 205 ,
47
- "MACOS" : 10 ,
48
- "WINDOWS" : 90 ,
49
- },
50
- }
51
- if ! cmp .Equal (hook , want ) {
52
- t .Errorf ("Billing.GetActionsBillingOrg returned %+v, want %+v" , hook , want )
53
- }
54
-
55
- const methodName = "GetActionsBillingOrg"
56
- testBadOptions (t , methodName , func () (err error ) {
57
- _ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
58
- return err
59
- })
60
-
61
- testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
62
- got , resp , err := client .Billing .GetActionsBillingOrg (ctx , "o" )
63
- if got != nil {
64
- t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
65
- }
66
- return resp , err
67
- })
68
- }
69
-
70
- func TestBillingService_GetActionsBillingOrg_invalidOrg (t * testing.T ) {
71
- t .Parallel ()
72
- client , _ , _ := setup (t )
73
-
74
- ctx := context .Background ()
75
- _ , _ , err := client .Billing .GetActionsBillingOrg (ctx , "%" )
76
- testURLParseError (t , err )
77
- }
78
-
79
17
func TestBillingService_GetPackagesBillingOrg (t * testing.T ) {
80
18
t .Parallel ()
81
19
client , mux , _ := setup (t )
@@ -180,68 +118,6 @@ func TestBillingService_GetStorageBillingOrg_invalidOrg(t *testing.T) {
180
118
testURLParseError (t , err )
181
119
}
182
120
183
- func TestBillingService_GetActionsBillingUser (t * testing.T ) {
184
- t .Parallel ()
185
- client , mux , _ := setup (t )
186
-
187
- mux .HandleFunc ("/users/u/settings/billing/actions" , func (w http.ResponseWriter , r * http.Request ) {
188
- testMethod (t , r , "GET" )
189
- fmt .Fprint (w , `{
190
- "total_minutes_used": 10,
191
- "total_paid_minutes_used": 0,
192
- "included_minutes": 3000,
193
- "minutes_used_breakdown": {
194
- "UBUNTU": 205,
195
- "MACOS": 10,
196
- "WINDOWS": 90
197
- }
198
- }` )
199
- })
200
-
201
- ctx := context .Background ()
202
- hook , _ , err := client .Billing .GetActionsBillingUser (ctx , "u" )
203
- if err != nil {
204
- t .Errorf ("Billing.GetActionsBillingUser returned error: %v" , err )
205
- }
206
-
207
- want := & ActionBilling {
208
- TotalMinutesUsed : 10 ,
209
- TotalPaidMinutesUsed : 0 ,
210
- IncludedMinutes : 3000 ,
211
- MinutesUsedBreakdown : MinutesUsedBreakdown {
212
- "UBUNTU" : 205 ,
213
- "MACOS" : 10 ,
214
- "WINDOWS" : 90 ,
215
- },
216
- }
217
- if ! cmp .Equal (hook , want ) {
218
- t .Errorf ("Billing.GetActionsBillingUser returned %+v, want %+v" , hook , want )
219
- }
220
-
221
- const methodName = "GetActionsBillingUser"
222
- testBadOptions (t , methodName , func () (err error ) {
223
- _ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
224
- return err
225
- })
226
-
227
- testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
228
- got , resp , err := client .Billing .GetActionsBillingUser (ctx , "o" )
229
- if got != nil {
230
- t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
231
- }
232
- return resp , err
233
- })
234
- }
235
-
236
- func TestBillingService_GetActionsBillingUser_invalidUser (t * testing.T ) {
237
- t .Parallel ()
238
- client , _ , _ := setup (t )
239
-
240
- ctx := context .Background ()
241
- _ , _ , err := client .Billing .GetActionsBillingUser (ctx , "%" )
242
- testURLParseError (t , err )
243
- }
244
-
245
121
func TestBillingService_GetPackagesBillingUser (t * testing.T ) {
246
122
t .Parallel ()
247
123
client , mux , _ := setup (t )
@@ -365,35 +241,6 @@ func TestMinutesUsedBreakdown_Marshal(t *testing.T) {
365
241
testJSONMarshal (t , u , want )
366
242
}
367
243
368
- func TestActionBilling_Marshal (t * testing.T ) {
369
- t .Parallel ()
370
- testJSONMarshal (t , & MinutesUsedBreakdown {}, "{}" )
371
-
372
- u := & ActionBilling {
373
- TotalMinutesUsed : 1 ,
374
- TotalPaidMinutesUsed : 1 ,
375
- IncludedMinutes : 1 ,
376
- MinutesUsedBreakdown : MinutesUsedBreakdown {
377
- "UBUNTU" : 1 ,
378
- "MACOS" : 1 ,
379
- "WINDOWS" : 1 ,
380
- },
381
- }
382
-
383
- want := `{
384
- "total_minutes_used": 1,
385
- "total_paid_minutes_used": 1,
386
- "included_minutes": 1,
387
- "minutes_used_breakdown": {
388
- "UBUNTU": 1,
389
- "MACOS": 1,
390
- "WINDOWS": 1
391
- }
392
- }`
393
-
394
- testJSONMarshal (t , u , want )
395
- }
396
-
397
244
func TestPackageBilling_Marshal (t * testing.T ) {
398
245
t .Parallel ()
399
246
testJSONMarshal (t , & PackageBilling {}, "{}" )
0 commit comments