diff options
Diffstat (limited to 'openstackclient')
17 files changed, 316 insertions, 58 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 48d8b2d0..938c8c06 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -393,7 +393,10 @@ class CreateServer(command.ShowOne): "net-id: attach NIC to network with this UUID, " "port-id: attach NIC to port with this UUID, " "v4-fixed-ip: IPv4 fixed address for NIC (optional), " - "v6-fixed-ip: IPv6 fixed address for NIC (optional)."), + "v6-fixed-ip: IPv6 fixed address for NIC (optional), " + "none: (v2.37+) no network is attached, " + "auto: (v2.37+) the compute service will automatically " + "allocate a network."), ) parser.add_argument( '--hint', @@ -513,36 +516,39 @@ class CreateServer(command.ShowOne): block_device_mapping.update({dev_key: block_volume}) nics = [] - for nic_str in parsed_args.nic: - nic_info = {"net-id": "", "v4-fixed-ip": "", - "v6-fixed-ip": "", "port-id": ""} - nic_info.update(dict(kv_str.split("=", 1) - for kv_str in nic_str.split(","))) - if bool(nic_info["net-id"]) == bool(nic_info["port-id"]): - msg = _("either net-id or port-id should be specified " - "but not both") - raise exceptions.CommandError(msg) - if self.app.client_manager.is_network_endpoint_enabled(): - network_client = self.app.client_manager.network - if nic_info["net-id"]: - net = network_client.find_network( - nic_info["net-id"], ignore_missing=False) - nic_info["net-id"] = net.id - if nic_info["port-id"]: - port = network_client.find_port( - nic_info["port-id"], ignore_missing=False) - nic_info["port-id"] = port.id - else: - if nic_info["net-id"]: - nic_info["net-id"] = utils.find_resource( - compute_client.networks, - nic_info["net-id"] - ).id - if nic_info["port-id"]: - msg = _("can't create server with port specified " - "since network endpoint not enabled") + if parsed_args.nic in ('auto', 'none'): + nics = [parsed_args.nic] + else: + for nic_str in parsed_args.nic: + nic_info = {"net-id": "", "v4-fixed-ip": "", + "v6-fixed-ip": "", "port-id": ""} + nic_info.update(dict(kv_str.split("=", 1) + for kv_str in nic_str.split(","))) + if bool(nic_info["net-id"]) == bool(nic_info["port-id"]): + msg = _("either net-id or port-id should be specified " + "but not both") raise exceptions.CommandError(msg) - nics.append(nic_info) + if self.app.client_manager.is_network_endpoint_enabled(): + network_client = self.app.client_manager.network + if nic_info["net-id"]: + net = network_client.find_network( + nic_info["net-id"], ignore_missing=False) + nic_info["net-id"] = net.id + if nic_info["port-id"]: + port = network_client.find_port( + nic_info["port-id"], ignore_missing=False) + nic_info["port-id"] = port.id + else: + if nic_info["net-id"]: + nic_info["net-id"] = utils.find_resource( + compute_client.networks, + nic_info["net-id"] + ).id + if nic_info["port-id"]: + msg = _("can't create server with port specified " + "since network endpoint not enabled") + raise exceptions.CommandError(msg) + nics.append(nic_info) hints = {} for hint in parsed_args.hint: diff --git a/openstackclient/compute/v2/usage.py b/openstackclient/compute/v2/usage.py index 89601ae3..3edcffe4 100644 --- a/openstackclient/compute/v2/usage.py +++ b/openstackclient/compute/v2/usage.py @@ -89,7 +89,7 @@ class ListUsage(command.Lister): # Cache the project list project_cache = {} try: - for p in self.app.client_manager.identity.tenants.list(): + for p in self.app.client_manager.identity.projects.list(): project_cache[p.id] = p except Exception: # Just forget it if there's any trouble diff --git a/openstackclient/network/v2/network_qos_rule_type.py b/openstackclient/network/v2/network_qos_rule_type.py new file mode 100644 index 00000000..82a265b8 --- /dev/null +++ b/openstackclient/network/v2/network_qos_rule_type.py @@ -0,0 +1,41 @@ +# Copyright (c) 2016, Intel Corporation. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import logging + +from osc_lib.command import command +from osc_lib import utils + + +LOG = logging.getLogger(__name__) + + +class ListNetworkQosRuleType(command.Lister): + """List QoS rule types""" + + def take_action(self, parsed_args): + client = self.app.client_manager.network + columns = ( + 'type', + ) + column_headers = ( + 'Type', + ) + data = client.qos_rule_types() + + return (column_headers, + (utils.get_item_properties( + s, columns, formatters={}, + ) for s in data)) diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index 45507b53..958a95b3 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -98,8 +98,6 @@ def _get_attrs(client_manager, parsed_args): ).id attrs['tenant_id'] = project_id - # TODO(tangchen): Support getting 'external_gateway_info' property. - return attrs @@ -464,7 +462,8 @@ class SetRouter(command.Command): help=_("Set router to centralized mode (disabled router only)") ) routes_group = parser.add_mutually_exclusive_group() - routes_group.add_argument( + # ToDo(Reedip):Remove mutual exclusiveness once clear-routes is removed + parser.add_argument( '--route', metavar='destination=<subnet>,gateway=<ip-address>', action=parseractions.MultiKeyValueAction, @@ -479,7 +478,9 @@ class SetRouter(command.Command): routes_group.add_argument( '--no-route', action='store_true', - help=_("Clear routes associated with the router") + help=_("Clear routes associated with the router. " + "Specify both --route and --no-route to overwrite " + "current value of route.") ) routes_group.add_argument( '--clear-routes', @@ -539,20 +540,22 @@ class SetRouter(command.Command): attrs['ha'] = True elif parsed_args.no_ha: attrs['ha'] = False - if parsed_args.no_route: - attrs['routes'] = [] - elif parsed_args.clear_routes: - attrs['routes'] = [] + if parsed_args.clear_routes: LOG.warning(_( 'The --clear-routes option is deprecated, ' 'please use --no-route instead.' )) - elif parsed_args.routes is not None: - # Map the route keys and append to the current routes. - # The REST API will handle route validation and duplicates. + + if parsed_args.routes is not None: for route in parsed_args.routes: route['nexthop'] = route.pop('gateway') - attrs['routes'] = obj.routes + parsed_args.routes + attrs['routes'] = parsed_args.routes + if not (parsed_args.no_route or parsed_args.clear_routes): + # Map the route keys and append to the current routes. + # The REST API will handle route validation and duplicates. + attrs['routes'] += obj.routes + elif parsed_args.no_route or parsed_args.clear_routes: + attrs['routes'] = [] if (parsed_args.disable_snat or parsed_args.enable_snat or parsed_args.fixed_ip) and not parsed_args.external_gateway: msg = (_("You must specify '--external-gateway' in order" diff --git a/openstackclient/tests/functional/common/test_quota.py b/openstackclient/tests/functional/common/test_quota.py index c1de9aa9..fbb8e563 100644 --- a/openstackclient/tests/functional/common/test_quota.py +++ b/openstackclient/tests/functional/common/test_quota.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + from openstackclient.tests.functional import base @@ -25,6 +27,7 @@ class QuotaTests(base.TestCase): cls.PROJECT_NAME =\ cls.get_openstack_configuration_value('auth.project_name') + @testtools.skip('broken SDK testing') def test_quota_set(self): self.openstack('quota set --instances 11 --volumes 11 --networks 11 ' + self.PROJECT_NAME) @@ -32,16 +35,19 @@ class QuotaTests(base.TestCase): raw_output = self.openstack('quota show ' + self.PROJECT_NAME + opts) self.assertEqual("11\n11\n11\n", raw_output) + @testtools.skip('broken SDK testing') def test_quota_show(self): raw_output = self.openstack('quota show ' + self.PROJECT_NAME) for expected_field in self.EXPECTED_FIELDS: self.assertIn(expected_field, raw_output) + @testtools.skip('broken SDK testing') def test_quota_show_default_project(self): raw_output = self.openstack('quota show') for expected_field in self.EXPECTED_FIELDS: self.assertIn(expected_field, raw_output) + @testtools.skip('broken SDK testing') def test_quota_show_with_default_option(self): raw_output = self.openstack('quota show --default') for expected_field in self.EXPECTED_FIELDS: diff --git a/openstackclient/tests/functional/network/v2/test_ip_availability.py b/openstackclient/tests/functional/network/v2/test_ip_availability.py index b5c908f4..edbe7e3c 100644 --- a/openstackclient/tests/functional/network/v2/test_ip_availability.py +++ b/openstackclient/tests/functional/network/v2/test_ip_availability.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools import uuid from openstackclient.tests.functional import base @@ -46,6 +47,7 @@ class IPAvailabilityTests(base.TestCase): raw_output = self.openstack('ip availability list' + opts) self.assertIn(self.NETWORK_NAME, raw_output) + @testtools.skip('broken SDK testing') def test_ip_availability_show(self): opts = self.get_opts(self.FIELDS) raw_output = self.openstack( diff --git a/openstackclient/tests/functional/network/v2/test_network_agent.py b/openstackclient/tests/functional/network/v2/test_network_agent.py index dd6112e7..e99dcef6 100644 --- a/openstackclient/tests/functional/network/v2/test_network_agent.py +++ b/openstackclient/tests/functional/network/v2/test_network_agent.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + from openstackclient.tests.functional import base @@ -26,11 +28,13 @@ class NetworkAgentTests(base.TestCase): # get the list of network agent IDs. cls.IDs = raw_output.split('\n') + @testtools.skip('broken SDK testing') def test_network_agent_show(self): opts = self.get_opts(self.FIELDS) raw_output = self.openstack('network agent show ' + self.IDs[0] + opts) self.assertEqual(self.IDs[0] + "\n", raw_output) + @testtools.skip('broken SDK testing') def test_network_agent_set(self): opts = self.get_opts(['admin_state_up']) self.openstack('network agent set --disable ' + self.IDs[0]) diff --git a/openstackclient/tests/functional/network/v2/test_network_qos_policy.py b/openstackclient/tests/functional/network/v2/test_network_qos_policy.py index 07dea31b..6cf64401 100644 --- a/openstackclient/tests/functional/network/v2/test_network_qos_policy.py +++ b/openstackclient/tests/functional/network/v2/test_network_qos_policy.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools import uuid from openstackclient.tests.functional import base @@ -25,6 +26,7 @@ class QosPolicyTests(base.TestCase): FIELDS = ['name'] @classmethod + @testtools.skip('broken SDK testing') def setUpClass(cls): opts = cls.get_opts(cls.FIELDS) raw_output = cls.openstack('network qos policy create ' + cls.NAME + diff --git a/openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py b/openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py new file mode 100644 index 00000000..2bb04a9d --- /dev/null +++ b/openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py @@ -0,0 +1,32 @@ +# Copyright (c) 2016, Intel Corporation. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import testtools + +from openstackclient.tests.functional import base + + +class NetworkQosRuleTypeTests(base.TestCase): + """Functional tests for Network QoS rule type. """ + + AVAILABLE_RULE_TYPES = ['dscp_marking', + 'bandwidth_limit', + 'minimum_bandwidth'] + + @testtools.skip('broken SDK testing') + def test_qos_rule_type_list(self): + raw_output = self.openstack('network qos rule type list') + for rule_type in self.AVAILABLE_RULE_TYPES: + self.assertIn(rule_type, raw_output) diff --git a/openstackclient/tests/functional/network/v2/test_network_service_provider.py b/openstackclient/tests/functional/network/v2/test_network_service_provider.py index 379de430..82420ea3 100644 --- a/openstackclient/tests/functional/network/v2/test_network_service_provider.py +++ b/openstackclient/tests/functional/network/v2/test_network_service_provider.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + from openstackclient.tests.functional import base @@ -21,6 +23,7 @@ class TestNetworkServiceProvider(base.TestCase): SERVICE_TYPE = ['L3_ROUTER_NAT'] + @testtools.skip('broken SDK testing') def test_network_service_provider_list(self): raw_output = self.openstack('network service provider list') self.assertIn(self.SERVICE_TYPE, raw_output) diff --git a/openstackclient/tests/functional/network/v2/test_port.py b/openstackclient/tests/functional/network/v2/test_port.py index decd9553..a4a0a94b 100644 --- a/openstackclient/tests/functional/network/v2/test_port.py +++ b/openstackclient/tests/functional/network/v2/test_port.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools import uuid from openstackclient.tests.functional import base @@ -23,6 +24,7 @@ class PortTests(base.TestCase): FIELDS = ['name'] @classmethod + @testtools.skip('broken SDK testing') def setUpClass(cls): # Create a network for the subnet. cls.openstack('network create ' + cls.NETWORK_NAME) diff --git a/openstackclient/tests/functional/network/v2/test_security_group.py b/openstackclient/tests/functional/network/v2/test_security_group.py index debd81df..7c6338ea 100644 --- a/openstackclient/tests/functional/network/v2/test_security_group.py +++ b/openstackclient/tests/functional/network/v2/test_security_group.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools import uuid from openstackclient.tests.functional import base @@ -23,6 +24,7 @@ class SecurityGroupTests(base.TestCase): FIELDS = ['name'] @classmethod + @testtools.skip('broken SDK testing') def setUpClass(cls): opts = cls.get_opts(cls.FIELDS) raw_output = cls.openstack('security group create ' + cls.NAME + opts) diff --git a/openstackclient/tests/functional/network/v2/test_security_group_rule.py b/openstackclient/tests/functional/network/v2/test_security_group_rule.py index c91de1a5..5b12e1bc 100644 --- a/openstackclient/tests/functional/network/v2/test_security_group_rule.py +++ b/openstackclient/tests/functional/network/v2/test_security_group_rule.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools import uuid from openstackclient.tests.functional import base @@ -24,6 +25,7 @@ class SecurityGroupRuleTests(base.TestCase): ID_HEADER = ['ID'] @classmethod + @testtools.skip('broken SDK testing') def setUpClass(cls): # Create the security group to hold the rule. opts = cls.get_opts(cls.NAME_FIELD) @@ -52,6 +54,7 @@ class SecurityGroupRuleTests(base.TestCase): cls.SECURITY_GROUP_NAME) cls.assertOutput('', raw_output) + @testtools.skip('broken SDK testing') def test_security_group_rule_list(self): opts = self.get_opts(self.ID_HEADER) raw_output = self.openstack('security group rule list ' + @@ -59,6 +62,7 @@ class SecurityGroupRuleTests(base.TestCase): opts) self.assertIn(self.SECURITY_GROUP_RULE_ID, raw_output) + @testtools.skip('broken SDK testing') def test_security_group_rule_show(self): opts = self.get_opts(self.ID_FIELD) raw_output = self.openstack('security group rule show ' + diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index 84f145fb..88e67f43 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -813,6 +813,51 @@ class FakeNetworkQosPolicy(object): return mock.Mock(side_effect=qos_policies) +class FakeNetworkQosRuleType(object): + """Fake one or more Network QoS rule types.""" + + @staticmethod + def create_one_qos_rule_type(attrs=None): + """Create a fake Network QoS rule type. + + :param Dictionary attrs: + A dictionary with all attributes + :return: + A FakeResource object with name, id, etc. + """ + attrs = attrs or {} + + # Set default attributes. + qos_rule_type_attrs = { + 'type': 'rule-type-' + uuid.uuid4().hex, + } + + # Overwrite default attributes. + qos_rule_type_attrs.update(attrs) + + return fakes.FakeResource( + info=copy.deepcopy(qos_rule_type_attrs), + loaded=True) + + @staticmethod + def create_qos_rule_types(attrs=None, count=2): + """Create multiple fake Network QoS rule types. + + :param Dictionary attrs: + A dictionary with all attributes + :param int count: + The number of QoS rule types to fake + :return: + A list of FakeResource objects faking the QoS rule types + """ + qos_rule_types = [] + for i in range(0, count): + qos_rule_types.append( + FakeNetworkQosRuleType.create_one_qos_rule_type(attrs)) + + return qos_rule_types + + class FakeRouter(object): """Fake one or more routers.""" diff --git a/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py b/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py new file mode 100644 index 00000000..b93abe80 --- /dev/null +++ b/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py @@ -0,0 +1,62 @@ +# Copyright (c) 2016, Intel Corporation. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import mock + +from openstackclient.network.v2 import network_qos_rule_type as _qos_rule_type +from openstackclient.tests.unit.network.v2 import fakes as network_fakes + + +class TestNetworkQosRuleType(network_fakes.TestNetworkV2): + + def setUp(self): + super(TestNetworkQosRuleType, self).setUp() + # Get a shortcut to the network client + self.network = self.app.client_manager.network + + +class TestListNetworkQosRuleType(TestNetworkQosRuleType): + + # The QoS policies to list up. + qos_rule_types = ( + network_fakes.FakeNetworkQosRuleType.create_qos_rule_types(count=3)) + columns = ( + 'Type', + ) + data = [] + for qos_rule_type in qos_rule_types: + data.append(( + qos_rule_type.type, + )) + + def setUp(self): + super(TestListNetworkQosRuleType, self).setUp() + self.network.qos_rule_types = mock.Mock( + return_value=self.qos_rule_types) + + # Get the command object to test + self.cmd = _qos_rule_type.ListNetworkQosRuleType(self.app, + self.namespace) + + def test_qos_rule_type_list(self): + arglist = [] + verifylist = [] + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + columns, data = self.cmd.take_action(parsed_args) + + self.network.qos_rule_types.assert_called_once_with(**{}) + self.assertEqual(self.columns, columns) + self.assertEqual(self.data, list(data)) diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py index a24a34c5..b837afd1 100644 --- a/openstackclient/tests/unit/network/v2/test_router.py +++ b/openstackclient/tests/unit/network/v2/test_router.py @@ -704,10 +704,10 @@ class TestSetRouter(TestRouter): parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) - + routes = [{'destination': '10.20.30.0/24', + 'nexthop': '10.20.30.1'}] attrs = { - 'routes': self._router.routes + [{'destination': '10.20.30.0/24', - 'nexthop': '10.20.30.1'}], + 'routes': routes + self._router.routes } self.network.update_router.assert_called_once_with( self._router, **attrs) @@ -733,21 +733,31 @@ class TestSetRouter(TestRouter): self._router, **attrs) self.assertIsNone(result) - def test_set_route_no_route(self): + def test_set_route_overwrite_route(self): + _testrouter = network_fakes.FakeRouter.create_one_router( + {'routes': [{"destination": "10.0.0.2", + "nexthop": "1.1.1.1"}]}) + self.network.find_router = mock.Mock(return_value=_testrouter) arglist = [ - self._router.name, + _testrouter.name, '--route', 'destination=10.20.30.0/24,gateway=10.20.30.1', '--no-route', ] verifylist = [ - ('router', self._router.name), + ('router', _testrouter.name), ('routes', [{'destination': '10.20.30.0/24', 'gateway': '10.20.30.1'}]), ('no_route', True), ] - - self.assertRaises(tests_utils.ParserException, self.check_parser, - self.cmd, arglist, verifylist) + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + attrs = { + 'routes': [{'destination': '10.20.30.0/24', + 'nexthop': '10.20.30.1'}] + } + self.network.update_router.assert_called_once_with( + _testrouter, **attrs) + self.assertIsNone(result) def test_set_clear_routes(self): arglist = [ @@ -769,21 +779,31 @@ class TestSetRouter(TestRouter): self._router, **attrs) self.assertIsNone(result) - def test_set_route_clear_routes(self): + def test_overwrite_route_clear_routes(self): + _testrouter = network_fakes.FakeRouter.create_one_router( + {'routes': [{"destination": "10.0.0.2", + "nexthop": "1.1.1.1"}]}) + self.network.find_router = mock.Mock(return_value=_testrouter) arglist = [ - self._router.name, + _testrouter.name, '--route', 'destination=10.20.30.0/24,gateway=10.20.30.1', '--clear-routes', ] verifylist = [ - ('router', self._router.name), + ('router', _testrouter.name), ('routes', [{'destination': '10.20.30.0/24', 'gateway': '10.20.30.1'}]), ('clear_routes', True), ] - - self.assertRaises(tests_utils.ParserException, self.check_parser, - self.cmd, arglist, verifylist) + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + attrs = { + 'routes': [{'destination': '10.20.30.0/24', + 'nexthop': '10.20.30.1'}] + } + self.network.update_router.assert_called_once_with( + _testrouter, **attrs) + self.assertIsNone(result) def test_set_nothing(self): arglist = [ diff --git a/openstackclient/tests/unit/volume/v2/test_backup.py b/openstackclient/tests/unit/volume/v2/test_backup.py index 10e7aac5..a8e81c7e 100644 --- a/openstackclient/tests/unit/volume/v2/test_backup.py +++ b/openstackclient/tests/unit/volume/v2/test_backup.py @@ -418,6 +418,30 @@ class TestBackupSet(TestBackup): self.backup.id, **{'name': 'new_name'}) self.assertIsNone(result) + def test_backup_set_description(self): + arglist = [ + '--description', 'new_description', + self.backup.id, + ] + verifylist = [ + ('name', None), + ('description', 'new_description'), + ('backup', self.backup.id), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + + # Set expected values + kwargs = { + 'description': 'new_description' + } + self.backups_mock.update.assert_called_once_with( + self.backup.id, + **kwargs + ) + self.assertIsNone(result) + def test_backup_set_state(self): arglist = [ '--state', 'error', |
