@@ -394,6 +394,70 @@ def test_consistency_group_list_with_long(self):
394394 self .assertEqual (self .data_long , list (data ))
395395
396396
397+ class TestConsistencyGroupSet (TestConsistencyGroup ):
398+
399+ consistency_group = (
400+ volume_fakes .FakeConsistencyGroup .create_one_consistency_group ())
401+
402+ def setUp (self ):
403+ super (TestConsistencyGroupSet , self ).setUp ()
404+
405+ self .consistencygroups_mock .get .return_value = (
406+ self .consistency_group )
407+ # Get the command object to test
408+ self .cmd = consistency_group .SetConsistencyGroup (self .app , None )
409+
410+ def test_consistency_group_set_name (self ):
411+ new_name = 'new_name'
412+ arglist = [
413+ '--name' , new_name ,
414+ self .consistency_group .id ,
415+ ]
416+ verifylist = [
417+ ('name' , new_name ),
418+ ('description' , None ),
419+ ('consistency_group' , self .consistency_group .id ),
420+ ]
421+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
422+
423+ result = self .cmd .take_action (parsed_args )
424+
425+ # Set expected values
426+ kwargs = {
427+ 'name' : new_name ,
428+ }
429+ self .consistencygroups_mock .update .assert_called_once_with (
430+ self .consistency_group .id ,
431+ ** kwargs
432+ )
433+ self .assertIsNone (result )
434+
435+ def test_consistency_group_set_description (self ):
436+ new_description = 'new_description'
437+ arglist = [
438+ '--description' , new_description ,
439+ self .consistency_group .id ,
440+ ]
441+ verifylist = [
442+ ('name' , None ),
443+ ('description' , new_description ),
444+ ('consistency_group' , self .consistency_group .id ),
445+ ]
446+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
447+
448+ result = self .cmd .take_action (parsed_args )
449+
450+ # Set expected values
451+ kwargs = {
452+ 'description' : new_description ,
453+ }
454+ self .consistencygroups_mock .update .assert_called_once_with (
455+ self .consistency_group .id ,
456+ ** kwargs
457+ )
458+ self .assertIsNone (result )
459+
460+
397461class TestConsistencyGroupShow (TestConsistencyGroup ):
398462 columns = (
399463 'availability_zone' ,
0 commit comments