-
Notifications
You must be signed in to change notification settings - Fork 11
/
billing_test.go
97 lines (82 loc) · 2.99 KB
/
billing_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
package test
func (s *CLITestSuite) TestBillingCostList() {
tests := []CLITest{
{args: "billing cost list --start-date 2023-01-01 --end-date 2023-01-02", fixture: "billing/cost/list.golden"},
{args: "billing cost list --start-date 2023-01-01 --end-date 2023-01-02 -o json", fixture: "billing/cost/list-json.golden"},
{args: "billing cost list --start-date 2023-01-01 --end-date 2023-01-02 -o yaml", fixture: "billing/cost/list-yaml.golden"},
{args: "billing cost list --start-date 2023-01-01", fixture: "billing/cost/list-missing-flag.golden", exitCode: 1},
{args: "billing cost list --start-date 01-02-2023 --end-date 01-01-2023", fixture: "billing/cost/list-invalid-format.golden", exitCode: 1},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPriceList() {
tests := []CLITest{
{args: "billing price list --cloud aws --region us-east-1", fixture: "billing/price/list.golden"},
{args: "billing price list --cloud aws --region us-east-1 -o json", fixture: "billing/price/list-json.golden"},
{args: "billing price list --cloud aws --region us-east-1 --legacy", fixture: "billing/price/list-legacy.golden"},
{args: `billing price list --cloud aws --region ""`, fixture: "billing/price/list-empty-flag.golden", exitCode: 1},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPaymentDescribe() {
tests := []CLITest{
{args: "billing payment describe", fixture: "billing/payment/describe.golden"},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPaymentDescribe_MarketplaceOrg() {
tests := []CLITest{
{args: "billing payment describe", fixture: "billing/payment/describe-marketplace-org.golden"},
}
s.T().Setenv("IS_ORG_ON_MARKETPLACE", "true")
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPaymentUpdate() {
tests := []CLITest{
{
args: "billing payment update",
input: "4242424242424242\n12/70\n999\nBrian Strauch\n",
fixture: "billing/payment/update.golden",
},
{
args: "billing payment update",
input: "bad card number\n4242424242424242\nbad expiration\n12/70\nbad cvc\n999\nBrian Strauch\n",
fixture: "billing/payment/update-retry.golden",
},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPromoAdd() {
tests := []CLITest{
{args: "billing promo add PROMOCODE", fixture: "billing/promo/add.golden"},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}
func (s *CLITestSuite) TestBillingPromoList() {
tests := []CLITest{
{args: "billing promo list", fixture: "billing/promo/list.golden"},
{args: "billing promo list -o json", fixture: "billing/promo/list-json.golden"},
}
for _, test := range tests {
test.login = "cloud"
s.runIntegrationTest(test)
}
}