Skip to content

Commit 9ccf8fd

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Revert unit tests for quota commands"
2 parents 12ab5f0 + ef2a8f4 commit 9ccf8fd

1 file changed

Lines changed: 30 additions & 42 deletions

File tree

openstackclient/tests/unit/common/test_quota.py

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import copy
1414
import mock
1515

16-
from openstack.network.v2 import quota as _quota
17-
1816
from openstackclient.common import quota
1917
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
2018
from openstackclient.tests.unit import fakes
@@ -284,32 +282,27 @@ def test_quota_set_network(self):
284282
]
285283
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
286284

287-
# TODO(huanxuan): Remove this if condition once the fixed
288-
# SDK Quota class is the minimum required version.
289-
# This is expected to be SDK release 0.9.13
290-
if not hasattr(_quota.Quota, 'allow_get'):
291-
# Just run this when sdk <= 0.9.10
292-
result = self.cmd.take_action(parsed_args)
293-
kwargs = {
294-
'subnet': network_fakes.QUOTA['subnet'],
295-
'network': network_fakes.QUOTA['network'],
296-
'floatingip': network_fakes.QUOTA['floatingip'],
297-
'subnetpool': network_fakes.QUOTA['subnetpool'],
298-
'security_group_rule':
299-
network_fakes.QUOTA['security_group_rule'],
300-
'security_group': network_fakes.QUOTA['security_group'],
301-
'router': network_fakes.QUOTA['router'],
302-
'rbac_policy': network_fakes.QUOTA['rbac_policy'],
303-
'port': network_fakes.QUOTA['port'],
304-
'vip': network_fakes.QUOTA['vip'],
305-
'healthmonitor': network_fakes.QUOTA['healthmonitor'],
306-
'l7policy': network_fakes.QUOTA['l7policy'],
307-
}
308-
self.network_mock.update_quota.assert_called_once_with(
309-
identity_fakes.project_id,
310-
**kwargs
311-
)
312-
self.assertIsNone(result)
285+
result = self.cmd.take_action(parsed_args)
286+
kwargs = {
287+
'subnet': network_fakes.QUOTA['subnet'],
288+
'network': network_fakes.QUOTA['network'],
289+
'floatingip': network_fakes.QUOTA['floatingip'],
290+
'subnetpool': network_fakes.QUOTA['subnetpool'],
291+
'security_group_rule':
292+
network_fakes.QUOTA['security_group_rule'],
293+
'security_group': network_fakes.QUOTA['security_group'],
294+
'router': network_fakes.QUOTA['router'],
295+
'rbac_policy': network_fakes.QUOTA['rbac_policy'],
296+
'port': network_fakes.QUOTA['port'],
297+
'vip': network_fakes.QUOTA['vip'],
298+
'healthmonitor': network_fakes.QUOTA['healthmonitor'],
299+
'l7policy': network_fakes.QUOTA['l7policy'],
300+
}
301+
self.network_mock.update_quota.assert_called_once_with(
302+
identity_fakes.project_id,
303+
**kwargs
304+
)
305+
self.assertIsNone(result)
313306

314307
def test_quota_set_with_class(self):
315308
arglist = [
@@ -483,20 +476,15 @@ def test_quota_show_with_default(self):
483476

484477
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
485478

486-
# TODO(huanxuan): Remove this if condition once the fixed
487-
# SDK QuotaDefault class is the minimum required version.
488-
# This is expected to be SDK release 0.9.13
489-
if not hasattr(_quota.QuotaDefault, 'project'):
490-
# Just run this when sdk <= 0.9.10
491-
self.cmd.take_action(parsed_args)
492-
493-
self.quotas_mock.defaults.assert_called_once_with(
494-
identity_fakes.project_id)
495-
self.volume_quotas_mock.defaults.assert_called_once_with(
496-
identity_fakes.project_id)
497-
self.network.get_quota_default.assert_called_once_with(
498-
identity_fakes.project_id)
499-
self.assertNotCalled(self.network.get_quota)
479+
self.cmd.take_action(parsed_args)
480+
481+
self.quotas_mock.defaults.assert_called_once_with(
482+
identity_fakes.project_id)
483+
self.volume_quotas_mock.defaults.assert_called_once_with(
484+
identity_fakes.project_id)
485+
self.network.get_quota_default.assert_called_once_with(
486+
identity_fakes.project_id)
487+
self.assertNotCalled(self.network.get_quota)
500488

501489
def test_quota_show_with_class(self):
502490
arglist = [

0 commit comments

Comments
 (0)