Skip to content

Commit 19be070

Browse files
committed
tests: Remove unnecessary nesting of compute resources
Change-Id: I27326b8f2e0d84d3ef2c2fbdcb5c96a5ac1d79e4 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 347b444 commit 19be070

26 files changed

Lines changed: 1132 additions & 1282 deletions

openstackclient/tests/unit/common/test_availability_zone.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ def setUp(self):
114114

115115

116116
class TestAvailabilityZoneList(TestAvailabilityZone):
117-
compute_azs = (
118-
compute_fakes.FakeAvailabilityZone.create_availability_zones()
119-
)
117+
compute_azs = compute_fakes.create_availability_zones()
120118
volume_azs = volume_fakes.create_availability_zones(count=1)
121119
network_azs = network_fakes.create_availability_zones()
122120

openstackclient/tests/unit/common/test_extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TestExtensionList(TestExtension):
7272

7373
volume_extension = volume_fakes.create_one_extension()
7474
identity_extension = identity_fakes.FakeExtension.create_one_extension()
75-
compute_extension = compute_fakes.FakeExtension.create_one_extension()
75+
compute_extension = compute_fakes.create_one_extension()
7676
network_extension = network_fakes.FakeExtension.create_one_extension()
7777

7878
def setUp(self):

openstackclient/tests/unit/common/test_project_purge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def setUp(self):
6767

6868
class TestProjectPurge(TestProjectPurgeInit):
6969
project = identity_fakes.FakeProject.create_one_project()
70-
server = compute_fakes.FakeServer.create_one_server()
70+
server = compute_fakes.create_one_server()
7171
image = image_fakes.create_one_image()
7272
volume = volume_fakes.create_one_volume()
7373
backup = volume_fakes.create_one_backup()

openstackclient/tests/unit/common/test_quota.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ def setUp(self):
123123
self.projects_mock.list.return_value = self.projects
124124

125125
self.compute_quotas = [
126-
compute_fakes.FakeQuota.create_one_comp_quota(),
127-
compute_fakes.FakeQuota.create_one_comp_quota(),
126+
compute_fakes.create_one_comp_quota(),
127+
compute_fakes.create_one_comp_quota(),
128128
]
129129
self.compute_default_quotas = [
130-
compute_fakes.FakeQuota.create_one_default_comp_quota(),
131-
compute_fakes.FakeQuota.create_one_default_comp_quota(),
130+
compute_fakes.create_one_default_comp_quota(),
131+
compute_fakes.create_one_default_comp_quota(),
132132
]
133133
self.compute = self.app.client_manager.compute
134134
self.compute.quotas.defaults = mock.Mock(
@@ -216,9 +216,7 @@ def _get_detailed_reference_data(quota):
216216
return reference_data
217217

218218
def test_quota_list_details_compute(self):
219-
detailed_quota = (
220-
compute_fakes.FakeQuota.create_one_comp_detailed_quota()
221-
)
219+
detailed_quota = compute_fakes.create_one_comp_detailed_quota()
222220

223221
detailed_column_header = (
224222
'Resource',
@@ -338,7 +336,7 @@ def test_quota_list_compute_default(self):
338336
self.compute.quotas.get = mock.Mock(
339337
side_effect=[
340338
self.compute_quotas[0],
341-
compute_fakes.FakeQuota.create_one_default_comp_quota(),
339+
compute_fakes.create_one_default_comp_quota(),
342340
],
343341
)
344342

@@ -1087,10 +1085,10 @@ class TestQuotaShow(TestQuota):
10871085
def setUp(self):
10881086
super().setUp()
10891087

1090-
self.compute_quota = compute_fakes.FakeQuota.create_one_comp_quota()
1088+
self.compute_quota = compute_fakes.create_one_comp_quota()
10911089
self.compute_quotas_mock.get.return_value = self.compute_quota
10921090
self.compute_default_quota = (
1093-
compute_fakes.FakeQuota.create_one_default_comp_quota()
1091+
compute_fakes.create_one_default_comp_quota()
10941092
)
10951093
self.compute_quotas_mock.defaults.return_value = (
10961094
self.compute_default_quota
@@ -1269,9 +1267,7 @@ def test_quota_show__with_class(self):
12691267

12701268
def test_quota_show__with_usage(self):
12711269
# update mocks to return detailed quota instead
1272-
self.compute_quota = (
1273-
compute_fakes.FakeQuota.create_one_comp_detailed_quota()
1274-
)
1270+
self.compute_quota = compute_fakes.create_one_comp_detailed_quota()
12751271
self.compute_quotas_mock.get.return_value = self.compute_quota
12761272
self.volume_quota = volume_fakes.create_one_detailed_quota()
12771273
self.volume_quotas_mock.get.return_value = self.volume_quota

0 commit comments

Comments
 (0)