@@ -35,6 +35,7 @@ def setUp(self):
3535 self .host_mock .freeze_host .return_value = None
3636 self .host_mock .thaw_host .return_value = None
3737
38+ # Get the command object to mock
3839 self .cmd = volume_host .SetVolumeHost (self .app , None )
3940
4041 def test_volume_host_set_nothing (self ):
@@ -84,3 +85,33 @@ def test_volume_host_set_disable(self):
8485 self .host_mock .freeze_host .assert_called_with (self .service .host )
8586 self .host_mock .thaw_host .assert_not_called ()
8687 self .assertIsNone (result )
88+
89+
90+ class TestVolumeHostFailover (TestVolumeHost ):
91+
92+ service = host_fakes .FakeService .create_one_service ()
93+
94+ def setUp (self ):
95+ super (TestVolumeHostFailover , self ).setUp ()
96+
97+ self .host_mock .failover_host .return_value = None
98+
99+ # Get the command object to mock
100+ self .cmd = volume_host .FailoverVolumeHost (self .app , None )
101+
102+ def test_volume_host_failover (self ):
103+ arglist = [
104+ '--volume-backend' , 'backend_test' ,
105+ self .service .host ,
106+ ]
107+ verifylist = [
108+ ('volume_backend' , 'backend_test' ),
109+ ('host' , self .service .host ),
110+ ]
111+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
112+
113+ result = self .cmd .take_action (parsed_args )
114+
115+ self .host_mock .failover_host .assert_called_with (
116+ self .service .host , 'backend_test' )
117+ self .assertIsNone (result )
0 commit comments