1212# under the License.
1313#
1414
15+ from osc_lib .cli import format_columns
16+
1517from openstackclient .tests .unit .volume .v2 import fakes as volume_fakes
1618from openstackclient .volume .v2 import volume_backend
1719
@@ -25,9 +27,8 @@ class TestShowVolumeCapability(volume_fakes.TestVolume):
2527 def setUp (self ):
2628 super ().setUp ()
2729
28- # Get a shortcut to the capability Mock
29- self .capability_mock = self .volume_client .capabilities
30- self .capability_mock .get .return_value = self .capability
30+ # Assign return value to capabilities mock
31+ self .volume_sdk_client .get_capabilities .return_value = self .capability
3132
3233 # Get the command object to test
3334 self .cmd = volume_backend .ShowCapability (self .app , None )
@@ -68,7 +69,7 @@ def test_capability_show(self):
6869 self .assertIn (cap [0 ], capabilities )
6970
7071 # checking if proper call was made to get capabilities
71- self .capability_mock . get .assert_called_with (
72+ self .volume_sdk_client . get_capabilities .assert_called_with (
7273 'fake' ,
7374 )
7475
@@ -82,8 +83,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
8283 def setUp (self ):
8384 super ().setUp ()
8485
85- self .pool_mock = self .volume_client .pools
86- self .pool_mock .list .return_value = [self .pools ]
86+ self .volume_sdk_client .backend_pools .return_value = [self .pools ]
8787
8888 # Get the command object to test
8989 self .cmd = volume_backend .ListPool (self .app , None )
@@ -111,7 +111,7 @@ def test_pool_list(self):
111111 self .assertEqual (datalist , tuple (data ))
112112
113113 # checking if proper call was made to list pools
114- self .pool_mock . list .assert_called_with (
114+ self .volume_sdk_client . backend_pools .assert_called_with (
115115 detailed = False ,
116116 )
117117
@@ -131,13 +131,7 @@ def test_service_list_with_long_option(self):
131131
132132 expected_columns = [
133133 'Name' ,
134- 'Protocol' ,
135- 'Thick' ,
136- 'Thin' ,
137- 'Volumes' ,
138- 'Capacity' ,
139- 'Allocated' ,
140- 'Max Over Ratio' ,
134+ 'Capabilities' ,
141135 ]
142136
143137 # confirming if all expected columns are present in the result.
@@ -146,19 +140,13 @@ def test_service_list_with_long_option(self):
146140 datalist = (
147141 (
148142 self .pools .name ,
149- self .pools .storage_protocol ,
150- self .pools .thick_provisioning_support ,
151- self .pools .thin_provisioning_support ,
152- self .pools .total_volumes ,
153- self .pools .total_capacity_gb ,
154- self .pools .allocated_capacity_gb ,
155- self .pools .max_over_subscription_ratio ,
143+ format_columns .DictColumn (self .pools .capabilities ),
156144 ),
157145 )
158146
159147 # confirming if all expected values are present in the result.
160148 self .assertEqual (datalist , tuple (data ))
161149
162- self .pool_mock . list .assert_called_with (
150+ self .volume_sdk_client . backend_pools .assert_called_with (
163151 detailed = True ,
164152 )
0 commit comments