Merge "Revert unit tests for quota commands"

This commit is contained in:
Jenkins 2017-02-23 18:30:21 +00:00 committed by Gerrit Code Review
commit 9ccf8fd067

View File

@ -13,8 +13,6 @@
import copy import copy
import mock import mock
from openstack.network.v2 import quota as _quota
from openstackclient.common import quota from openstackclient.common import quota
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
from openstackclient.tests.unit import fakes from openstackclient.tests.unit import fakes
@ -284,32 +282,27 @@ class TestQuotaSet(TestQuota):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# TODO(huanxuan): Remove this if condition once the fixed result = self.cmd.take_action(parsed_args)
# SDK Quota class is the minimum required version. kwargs = {
# This is expected to be SDK release 0.9.13 'subnet': network_fakes.QUOTA['subnet'],
if not hasattr(_quota.Quota, 'allow_get'): 'network': network_fakes.QUOTA['network'],
# Just run this when sdk <= 0.9.10 'floatingip': network_fakes.QUOTA['floatingip'],
result = self.cmd.take_action(parsed_args) 'subnetpool': network_fakes.QUOTA['subnetpool'],
kwargs = { 'security_group_rule':
'subnet': network_fakes.QUOTA['subnet'], network_fakes.QUOTA['security_group_rule'],
'network': network_fakes.QUOTA['network'], 'security_group': network_fakes.QUOTA['security_group'],
'floatingip': network_fakes.QUOTA['floatingip'], 'router': network_fakes.QUOTA['router'],
'subnetpool': network_fakes.QUOTA['subnetpool'], 'rbac_policy': network_fakes.QUOTA['rbac_policy'],
'security_group_rule': 'port': network_fakes.QUOTA['port'],
network_fakes.QUOTA['security_group_rule'], 'vip': network_fakes.QUOTA['vip'],
'security_group': network_fakes.QUOTA['security_group'], 'healthmonitor': network_fakes.QUOTA['healthmonitor'],
'router': network_fakes.QUOTA['router'], 'l7policy': network_fakes.QUOTA['l7policy'],
'rbac_policy': network_fakes.QUOTA['rbac_policy'], }
'port': network_fakes.QUOTA['port'], self.network_mock.update_quota.assert_called_once_with(
'vip': network_fakes.QUOTA['vip'], identity_fakes.project_id,
'healthmonitor': network_fakes.QUOTA['healthmonitor'], **kwargs
'l7policy': network_fakes.QUOTA['l7policy'], )
} self.assertIsNone(result)
self.network_mock.update_quota.assert_called_once_with(
identity_fakes.project_id,
**kwargs
)
self.assertIsNone(result)
def test_quota_set_with_class(self): def test_quota_set_with_class(self):
arglist = [ arglist = [
@ -483,20 +476,15 @@ class TestQuotaShow(TestQuota):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# TODO(huanxuan): Remove this if condition once the fixed self.cmd.take_action(parsed_args)
# SDK QuotaDefault class is the minimum required version.
# This is expected to be SDK release 0.9.13
if not hasattr(_quota.QuotaDefault, 'project'):
# Just run this when sdk <= 0.9.10
self.cmd.take_action(parsed_args)
self.quotas_mock.defaults.assert_called_once_with( self.quotas_mock.defaults.assert_called_once_with(
identity_fakes.project_id) identity_fakes.project_id)
self.volume_quotas_mock.defaults.assert_called_once_with( self.volume_quotas_mock.defaults.assert_called_once_with(
identity_fakes.project_id) identity_fakes.project_id)
self.network.get_quota_default.assert_called_once_with( self.network.get_quota_default.assert_called_once_with(
identity_fakes.project_id) identity_fakes.project_id)
self.assertNotCalled(self.network.get_quota) self.assertNotCalled(self.network.get_quota)
def test_quota_show_with_class(self): def test_quota_show_with_class(self):
arglist = [ arglist = [