@@ -398,6 +398,43 @@ def test_volume_create_with_backup_pre_347(self):
398398 parsed_args )
399399 self .assertIn ("--os-volume-api-version 3.47 or greater" , str (exc ))
400400
401+ def test_volume_create_with_source_volume (self ):
402+ source_vol = "source_vol"
403+ arglist = [
404+ '--source' , self .new_volume .id ,
405+ source_vol ,
406+ ]
407+ verifylist = [
408+ ('source' , self .new_volume .id ),
409+ ('name' , source_vol ),
410+ ]
411+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
412+
413+ self .volumes_mock .get .return_value = self .new_volume
414+
415+ # In base command class ShowOne in cliff, abstract method take_action()
416+ # returns a two-part tuple with a tuple of column names and a tuple of
417+ # data to be shown.
418+ columns , data = self .cmd .take_action (parsed_args )
419+
420+ self .volumes_mock .create .assert_called_once_with (
421+ size = self .new_volume .size ,
422+ snapshot_id = None ,
423+ name = source_vol ,
424+ description = None ,
425+ volume_type = None ,
426+ availability_zone = None ,
427+ metadata = None ,
428+ imageRef = None ,
429+ source_volid = self .new_volume .id ,
430+ consistencygroup_id = None ,
431+ scheduler_hints = None ,
432+ backup_id = None ,
433+ )
434+
435+ self .assertEqual (self .columns , columns )
436+ self .assertCountEqual (self .datalist , data )
437+
401438 def test_volume_create_with_bootable_and_readonly (self ):
402439 arglist = [
403440 '--bootable' ,
0 commit comments