8
8
9
9
"github.com/aws/aws-sdk-go/aws/endpoints"
10
10
"github.com/spf13/viper"
11
- "github.com/stretchr/testify/assert"
12
11
"github.com/stretchr/testify/suite"
13
12
)
14
13
@@ -96,20 +95,21 @@ func (suite *cliTestSuite) TestCheckRegion() {
96
95
}
97
96
}
98
97
99
- func TestCheckProfileName (t * testing.T ) {
98
+ func (suite * cliTestSuite ) TestCheckProfileName () {
99
+ suite .Setup ()
100
100
testValues := []string {
101
101
"test-id" ,
102
102
"test-id1" ,
103
103
"test-id_1" ,
104
104
}
105
105
for _ , testValue := range testValues {
106
- assert .NoError (t , checkProfileName (testValue ))
106
+ suite .NoError (checkProfileName (testValue ))
107
107
}
108
108
testValuesWithErrors := []string {
109
109
"" ,
110
110
}
111
111
for _ , testValue := range testValuesWithErrors {
112
- assert .Error (t , checkProfileName (testValue ))
112
+ suite .Error (checkProfileName (testValue ))
113
113
}
114
114
}
115
115
@@ -132,17 +132,17 @@ func (suite *cliTestSuite) TestCheckAccountID() {
132
132
}
133
133
}
134
134
135
- func TestCheckProfileAccount ( t * testing. T ) {
136
- v := viper . New ()
135
+ func ( suite * cliTestSuite ) TestCheckProfileAccount ( ) {
136
+ suite . Setup ()
137
137
138
138
testValues := [][]string {
139
139
{"test-id:012345678901" },
140
140
{"test-id1:012345678901" , "test-id2:012345678901" , "test-id3:012345678901" },
141
141
}
142
142
for _ , testValue := range testValues {
143
- v .Set (AWSProfileAccountFlag , testValue )
144
- err := checkProfileAccount (v )
145
- assert .NoError (t , err )
143
+ suite . viper .Set (AWSProfileAccountFlag , testValue )
144
+ err := checkProfileAccount (suite . viper )
145
+ suite .NoError (err )
146
146
}
147
147
testValuesWithErrors := [][]string {
148
148
{"test-id:0123456789011" },
@@ -151,9 +151,9 @@ func TestCheckProfileAccount(t *testing.T) {
151
151
{"test-id012345678901" },
152
152
}
153
153
for _ , testValue := range testValuesWithErrors {
154
- v .Set (AWSProfileAccountFlag , testValue )
155
- err := checkProfileAccount (v )
156
- assert .Error (t , err )
154
+ suite . viper .Set (AWSProfileAccountFlag , testValue )
155
+ err := checkProfileAccount (suite . viper )
156
+ suite .Error (err )
157
157
}
158
158
}
159
159
0 commit comments