Skip to content

Commit df155ca

Browse files
committed
tests: Rename 'volume_sdk_client' -> 'volume_client'
Resolve a TODO. Achieved using: sed -i 's/self.volume_sdk_client/self.volume_client/' \ $(ag -w self.volume_sdk_client -l) Change-Id: I39b13249f0876c5fc53e8b921d88df6a1d0160b9 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent e82c68a commit df155ca

48 files changed

Lines changed: 1190 additions & 1249 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openstackclient/tests/unit/api/test_volume_v2.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def setUp(self):
3232
# TODO(stephenfin): Switch to spec_set once keystoneauth exposes
3333
# instance attributes as class attributes
3434
# https://review.opendev.org/c/openstack/keystoneauth/+/994090
35-
self.volume_sdk_client = mock.Mock(spec=block_storage_v2.Proxy)
35+
self.volume_client = mock.Mock(spec=block_storage_v2.Proxy)
3636

3737
def test_find_consistency_group_by_id(self):
3838
cg_id = uuid.uuid4().hex
@@ -48,13 +48,13 @@ def test_find_consistency_group_by_id(self):
4848
'volume_types': ['123456'],
4949
}
5050
}
51-
self.volume_sdk_client.get.side_effect = [
51+
self.volume_client.get.side_effect = [
5252
fakes.FakeResponse(data=data),
5353
]
5454

55-
result = volume.find_consistency_group(self.volume_sdk_client, cg_id)
55+
result = volume.find_consistency_group(self.volume_client, cg_id)
5656

57-
self.volume_sdk_client.get.assert_has_calls(
57+
self.volume_client.get.assert_has_calls(
5858
[
5959
mock.call(f'/consistencygroups/{cg_id}'),
6060
]
@@ -72,14 +72,14 @@ def test_find_consistency_group_by_name(self):
7272
}
7373
],
7474
}
75-
self.volume_sdk_client.get.side_effect = [
75+
self.volume_client.get.side_effect = [
7676
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
7777
fakes.FakeResponse(data=data),
7878
]
7979

80-
result = volume.find_consistency_group(self.volume_sdk_client, cg_name)
80+
result = volume.find_consistency_group(self.volume_client, cg_name)
8181

82-
self.volume_sdk_client.get.assert_has_calls(
82+
self.volume_client.get.assert_has_calls(
8383
[
8484
mock.call(f'/consistencygroups/{cg_name}'),
8585
mock.call('/consistencygroups'),
@@ -89,14 +89,14 @@ def test_find_consistency_group_by_name(self):
8989

9090
def test_find_consistency_group_not_found(self):
9191
data = {'consistencygroups': []}
92-
self.volume_sdk_client.get.side_effect = [
92+
self.volume_client.get.side_effect = [
9393
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
9494
fakes.FakeResponse(data=data),
9595
]
9696
self.assertRaises(
9797
osc_lib_exceptions.NotFound,
9898
volume.find_consistency_group,
99-
self.volume_sdk_client,
99+
self.volume_client,
100100
'invalid-cg',
101101
)
102102

@@ -114,14 +114,14 @@ def test_find_consistency_group_by_name_duplicate(self):
114114
},
115115
],
116116
}
117-
self.volume_sdk_client.get.side_effect = [
117+
self.volume_client.get.side_effect = [
118118
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
119119
fakes.FakeResponse(data=data),
120120
]
121121

122122
self.assertRaises(
123123
osc_lib_exceptions.NotFound,
124124
volume.find_consistency_group,
125-
self.volume_sdk_client,
125+
self.volume_client,
126126
cg_name,
127127
)

openstackclient/tests/unit/api/test_volume_v3.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def setUp(self):
3232
# TODO(stephenfin): Switch to spec_set once keystoneauth exposes
3333
# instance attributes as class attributes
3434
# https://review.opendev.org/c/openstack/keystoneauth/+/994090
35-
self.volume_sdk_client = mock.Mock(spec=block_storage_v3.Proxy)
35+
self.volume_client = mock.Mock(spec=block_storage_v3.Proxy)
3636

3737
def test_find_consistency_group_by_id(self):
3838
cg_id = uuid.uuid4().hex
@@ -48,13 +48,13 @@ def test_find_consistency_group_by_id(self):
4848
'volume_types': ['123456'],
4949
}
5050
}
51-
self.volume_sdk_client.get.side_effect = [
51+
self.volume_client.get.side_effect = [
5252
fakes.FakeResponse(data=data),
5353
]
5454

55-
result = volume.find_consistency_group(self.volume_sdk_client, cg_id)
55+
result = volume.find_consistency_group(self.volume_client, cg_id)
5656

57-
self.volume_sdk_client.get.assert_has_calls(
57+
self.volume_client.get.assert_has_calls(
5858
[
5959
mock.call(f'/consistencygroups/{cg_id}'),
6060
]
@@ -72,14 +72,14 @@ def test_find_consistency_group_by_name(self):
7272
}
7373
],
7474
}
75-
self.volume_sdk_client.get.side_effect = [
75+
self.volume_client.get.side_effect = [
7676
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
7777
fakes.FakeResponse(data=data),
7878
]
7979

80-
result = volume.find_consistency_group(self.volume_sdk_client, cg_name)
80+
result = volume.find_consistency_group(self.volume_client, cg_name)
8181

82-
self.volume_sdk_client.get.assert_has_calls(
82+
self.volume_client.get.assert_has_calls(
8383
[
8484
mock.call(f'/consistencygroups/{cg_name}'),
8585
mock.call('/consistencygroups'),
@@ -89,14 +89,14 @@ def test_find_consistency_group_by_name(self):
8989

9090
def test_find_consistency_group_not_found(self):
9191
data = {'consistencygroups': []}
92-
self.volume_sdk_client.get.side_effect = [
92+
self.volume_client.get.side_effect = [
9393
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
9494
fakes.FakeResponse(data=data),
9595
]
9696
self.assertRaises(
9797
osc_lib_exceptions.NotFound,
9898
volume.find_consistency_group,
99-
self.volume_sdk_client,
99+
self.volume_client,
100100
'invalid-cg',
101101
)
102102

@@ -114,14 +114,14 @@ def test_find_consistency_group_by_name_duplicate(self):
114114
},
115115
],
116116
}
117-
self.volume_sdk_client.get.side_effect = [
117+
self.volume_client.get.side_effect = [
118118
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
119119
fakes.FakeResponse(data=data),
120120
]
121121

122122
self.assertRaises(
123123
osc_lib_exceptions.NotFound,
124124
volume.find_consistency_group,
125-
self.volume_sdk_client,
125+
self.volume_client,
126126
cg_name,
127127
)

openstackclient/tests/unit/common/test_availability_zone.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ def setUp(self):
9797
self.network_azs = network_fakes.create_availability_zones()
9898
self.network_client.availability_zones.return_value = self.network_azs
9999
self.volume_azs = [_create_fake_volume_az()]
100-
self.volume_sdk_client.availability_zones.return_value = (
101-
self.volume_azs
102-
)
100+
self.volume_client.availability_zones.return_value = self.volume_azs
103101

104102
# Get the command object to test
105103
self.cmd = availability_zone.ListAvailabilityZone(self.app, None)
@@ -116,7 +114,7 @@ def test_availability_zone_list_no_options(self):
116114

117115
self.compute_client.availability_zones.assert_called_with(details=True)
118116
self.network_client.availability_zones.assert_called_with()
119-
self.volume_sdk_client.availability_zones.assert_called_with()
117+
self.volume_client.availability_zones.assert_called_with()
120118

121119
self.assertEqual(self.short_columnslist, columns)
122120
datalist = ()
@@ -144,7 +142,7 @@ def test_availability_zone_list_long(self):
144142

145143
self.compute_client.availability_zones.assert_called_with(details=True)
146144
self.network_client.availability_zones.assert_called_with()
147-
self.volume_sdk_client.availability_zones.assert_called_with()
145+
self.volume_client.availability_zones.assert_called_with()
148146

149147
self.assertEqual(self.long_columnslist, columns)
150148
datalist = ()
@@ -178,7 +176,7 @@ def test_availability_zone_list_compute(self):
178176

179177
self.compute_client.availability_zones.assert_called_with(details=True)
180178
self.network_client.availability_zones.assert_not_called()
181-
self.volume_sdk_client.availability_zones.assert_not_called()
179+
self.volume_client.availability_zones.assert_not_called()
182180

183181
self.assertEqual(self.short_columnslist, columns)
184182
datalist = ()
@@ -202,7 +200,7 @@ def test_availability_zone_list_network(self):
202200

203201
self.compute_client.availability_zones.assert_not_called()
204202
self.network_client.availability_zones.assert_called_with()
205-
self.volume_sdk_client.availability_zones.assert_not_called()
203+
self.volume_client.availability_zones.assert_not_called()
206204

207205
self.assertEqual(self.short_columnslist, columns)
208206
datalist = ()
@@ -226,7 +224,7 @@ def test_availability_zone_list_volume(self):
226224

227225
self.compute_client.availability_zones.assert_not_called()
228226
self.network_client.availability_zones.assert_not_called()
229-
self.volume_sdk_client.availability_zones.assert_called_with()
227+
self.volume_client.availability_zones.assert_called_with()
230228

231229
self.assertEqual(self.short_columnslist, columns)
232230
datalist = ()

openstackclient/tests/unit/common/test_extension.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ def setUp(self):
6060
self.identity_extension
6161
]
6262
self.compute_client.extensions.return_value = [self.compute_extension]
63-
self.volume_sdk_client.extensions.return_value = [
64-
self.volume_extension
65-
]
63+
self.volume_client.extensions.return_value = [self.volume_extension]
6664
self.network_client.extensions.return_value = [self.network_extension]
6765

6866
# Get the command object to test
@@ -112,7 +110,7 @@ def test_extension_list_no_options(self):
112110
self._test_extension_list_helper(arglist, verifylist, datalist)
113111
self.identity_sdk_client.extensions.assert_called_with()
114112
self.compute_client.extensions.assert_called_with()
115-
self.volume_sdk_client.extensions.assert_called_with()
113+
self.volume_client.extensions.assert_called_with()
116114
self.network_client.extensions.assert_called_with()
117115

118116
def test_extension_list_long(self):
@@ -159,7 +157,7 @@ def test_extension_list_long(self):
159157
self._test_extension_list_helper(arglist, verifylist, datalist, True)
160158
self.identity_sdk_client.extensions.assert_called_with()
161159
self.compute_client.extensions.assert_called_with()
162-
self.volume_sdk_client.extensions.assert_called_with()
160+
self.volume_client.extensions.assert_called_with()
163161
self.network_client.extensions.assert_called_with()
164162

165163
def test_extension_list_identity(self):
@@ -277,7 +275,7 @@ def test_extension_list_volume(self):
277275
),
278276
)
279277
self._test_extension_list_helper(arglist, verifylist, datalist)
280-
self.volume_sdk_client.extensions.assert_called_with()
278+
self.volume_client.extensions.assert_called_with()
281279

282280

283281
class TestExtensionShow(TestExtension):

openstackclient/tests/unit/common/test_limits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def setUp(self):
167167
('DELETE', '*', 100, 100, 'MINUTE', '2011-12-15T22:42:45Z'),
168168
]
169169

170-
self.volume_sdk_client.get_limits.return_value = self.fake_limits
170+
self.volume_client.get_limits.return_value = self.fake_limits
171171

172172
def test_volume_show_absolute(self):
173173
arglist = ['--absolute']

0 commit comments

Comments
 (0)