@@ -172,7 +172,11 @@ class TestTypeList(TestType):
172172 "Description" ,
173173 "Properties"
174174 ]
175-
175+ data_with_default_type = [(
176+ volume_types [0 ].id ,
177+ volume_types [0 ].name ,
178+ True
179+ )]
176180 data = []
177181 for t in volume_types :
178182 data .append ((
@@ -194,6 +198,7 @@ def setUp(self):
194198 super (TestTypeList , self ).setUp ()
195199
196200 self .types_mock .list .return_value = self .volume_types
201+ self .types_mock .default .return_value = self .volume_types [0 ]
197202 # get the command to test
198203 self .cmd = volume_type .ListVolumeType (self .app , None )
199204
@@ -203,6 +208,7 @@ def test_type_list_without_options(self):
203208 ("long" , False ),
204209 ("private" , False ),
205210 ("public" , False ),
211+ ("default" , False ),
206212 ]
207213 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
208214
@@ -220,6 +226,7 @@ def test_type_list_with_options(self):
220226 ("long" , True ),
221227 ("private" , False ),
222228 ("public" , True ),
229+ ("default" , False ),
223230 ]
224231 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
225232
@@ -236,6 +243,7 @@ def test_type_list_with_private_option(self):
236243 ("long" , False ),
237244 ("private" , True ),
238245 ("public" , False ),
246+ ("default" , False ),
239247 ]
240248 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
241249
@@ -244,6 +252,23 @@ def test_type_list_with_private_option(self):
244252 self .assertEqual (self .columns , columns )
245253 self .assertEqual (self .data , list (data ))
246254
255+ def test_type_list_with_default_option (self ):
256+ arglist = [
257+ "--default" ,
258+ ]
259+ verifylist = [
260+ ("long" , False ),
261+ ("private" , False ),
262+ ("public" , False ),
263+ ("default" , True ),
264+ ]
265+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
266+
267+ columns , data = self .cmd .take_action (parsed_args )
268+ self .types_mock .default .assert_called_once_with ()
269+ self .assertEqual (self .columns , columns )
270+ self .assertEqual (self .data_with_default_type , list (data ))
271+
247272
248273class TestTypeSet (TestType ):
249274
0 commit comments